Bug 1959147 - Part 2: Remove nsStringBundleService::FormatStatusMessage. r=xpcom-reviewers,emilio
XSLT was the last consumer of this method. After its migration to Fluent, it is not needed anymore. Also, remove properties files that were used only by FormatStatusMessage. Differential Revision: https://phabricator.services.mozilla.com/D245696
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
16389=An unknown error has occurred (%1$S)
|
||||
@@ -1,39 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
1 = Parsing an XSLT stylesheet failed.
|
||||
2 = Parsing an XPath expression failed.
|
||||
3 =
|
||||
4 = XSLT transformation failed.
|
||||
5 = Invalid XSLT/XPath function.
|
||||
6 = XSLT Stylesheet (possibly) contains a recursion.
|
||||
7 = Attribute value illegal in XSLT 1.0.
|
||||
8 = An XPath expression was expected to return a NodeSet.
|
||||
9 = XSLT transformation was terminated by <xsl:message>.
|
||||
10 = A network error occurred loading an XSLT stylesheet:
|
||||
11 = An XSLT stylesheet does not have an XML mimetype:
|
||||
12 = An XSLT stylesheet directly or indirectly imports or includes itself:
|
||||
13 = An XPath function was called with the wrong number of arguments.
|
||||
14 = An unknown XPath extension function was called.
|
||||
15 = XPath parse failure: ‘)’ expected:
|
||||
16 = XPath parse failure: invalid axis:
|
||||
17 = XPath parse failure: Name or Nodetype test expected:
|
||||
18 = XPath parse failure: ‘]’ expected:
|
||||
19 = XPath parse failure: invalid variable name:
|
||||
20 = XPath parse failure: unexpected end of expression:
|
||||
21 = XPath parse failure: operator expected:
|
||||
22 = XPath parse failure: unclosed literal:
|
||||
23 = XPath parse failure: ‘:’ unexpected:
|
||||
24 = XPath parse failure: ‘!’ unexpected, negation is not():
|
||||
25 = XPath parse failure: illegal character found:
|
||||
26 = XPath parse failure: binary operator expected:
|
||||
27 = An XSLT stylesheet load was blocked for security reasons.
|
||||
28 = Evaluating an invalid expression.
|
||||
29 = Unbalanced curly brace.
|
||||
30 = Creating an element with an invalid QName.
|
||||
31 = Variable binding shadows variable binding within the same template.
|
||||
32 = Call to the key function not allowed.
|
||||
|
||||
LoadingError = Error loading stylesheet: %S
|
||||
TransformError = Error during XSLT transformation: %S
|
||||
@@ -12,9 +12,7 @@
|
||||
locale/@AB_CD@/global/printing.properties (%chrome/layout/printing.properties)
|
||||
locale/@AB_CD@/global/layout_errors.properties (%chrome/layout/layout_errors.properties)
|
||||
locale/@AB_CD@/global/appstrings.properties (%chrome/appstrings.properties)
|
||||
locale/@AB_CD@/global/global-strres.properties (%chrome/global-strres.properties)
|
||||
locale/@AB_CD@/global/nsWebBrowserPersist.properties (%chrome/nsWebBrowserPersist.properties)
|
||||
locale/@AB_CD@/global/xslt/xslt.properties (%chrome/xslt/xslt.properties)
|
||||
locale/@AB_CD@/global/dom/dom.properties (%chrome/dom/dom.properties)
|
||||
locale/@AB_CD@/global/svg/svg.properties (%chrome/svg/svg.properties)
|
||||
locale/@AB_CD@/global/layout/MediaDocument.properties (%chrome/layout/MediaDocument.properties)
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
"txMozillaXSLTProcessor.h",
|
||||
"txXSLTMsgsURL.h",
|
||||
]
|
||||
|
||||
XPIDL_MODULE = "dom_xslt"
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef DOM_XSLT_XSLT_TXXSLTMSGSURL_H_
|
||||
#define DOM_XSLT_XSLT_TXXSLTMSGSURL_H_
|
||||
|
||||
#define XSLT_MSGS_URL "chrome://global/locale/xslt/xslt.properties"
|
||||
|
||||
#endif // DOM_XSLT_XSLT_TXXSLTMSGSURL_H_
|
||||
@@ -78,16 +78,6 @@ interface nsIStringBundleService : nsISupports
|
||||
{
|
||||
nsIStringBundle createBundle(in string aURLSpec);
|
||||
|
||||
/**
|
||||
* Formats a message string from a status code and status arguments.
|
||||
* @param aStatus - The status code. This is mapped into a string ID and
|
||||
* used in the string lookup process.
|
||||
* @param aStatusArg - The status message argument(s). Multiple arguments
|
||||
* can be separated by newline ('\n') characters.
|
||||
* @return the formatted message
|
||||
*/
|
||||
AString formatStatusMessage(in nsresult aStatus, in wstring aStatusArg);
|
||||
|
||||
/**
|
||||
* flushes the string bundle cache - useful when the locale changes or
|
||||
* when we need to get some extra memory back
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsSimpleEnumerator.h"
|
||||
#include "nsStringStream.h"
|
||||
#include "mozilla/dom/txXSLTMsgsURL.h"
|
||||
#include "mozilla/ipc/SharedMemoryHandle.h"
|
||||
#include "mozilla/BinarySearch.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
@@ -845,8 +844,9 @@ void nsStringBundleService::RegisterContentBundle(
|
||||
mSharedBundles.insertBack(cacheEntry);
|
||||
}
|
||||
|
||||
void nsStringBundleService::getStringBundle(const char* aURLSpec,
|
||||
nsIStringBundle** aResult) {
|
||||
NS_IMETHODIMP
|
||||
nsStringBundleService::CreateBundle(const char* aURLSpec,
|
||||
nsIStringBundle** aResult) {
|
||||
nsDependentCString key(aURLSpec);
|
||||
bundleCacheEntry_t* cacheEntry = mBundleMap.Get(key);
|
||||
|
||||
@@ -898,6 +898,8 @@ void nsStringBundleService::getStringBundle(const char* aURLSpec,
|
||||
// finally, return the value
|
||||
*aResult = cacheEntry->mBundle;
|
||||
NS_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
UniquePtr<bundleCacheEntry_t> nsStringBundleService::evictOneEntry() {
|
||||
@@ -931,82 +933,3 @@ bundleCacheEntry_t* nsStringBundleService::insertIntoCache(
|
||||
|
||||
return cacheEntry.release();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStringBundleService::CreateBundle(const char* aURLSpec,
|
||||
nsIStringBundle** aResult) {
|
||||
getStringBundle(aURLSpec, aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#define GLOBAL_PROPERTIES "chrome://global/locale/global-strres.properties"
|
||||
|
||||
nsresult nsStringBundleService::FormatWithBundle(
|
||||
nsIStringBundle* bundle, nsresult aStatus,
|
||||
const nsTArray<nsString>& argArray, nsAString& result) {
|
||||
nsresult rv;
|
||||
|
||||
// try looking up the error message with the int key:
|
||||
uint16_t code = NS_ERROR_GET_CODE(aStatus);
|
||||
rv = bundle->FormatStringFromID(code, argArray, result);
|
||||
|
||||
// If the int key fails, try looking up the default error message. E.g. print:
|
||||
// An unknown error has occurred (0x804B0003).
|
||||
if (NS_FAILED(rv)) {
|
||||
AutoTArray<nsString, 1> otherArgArray;
|
||||
otherArgArray.AppendElement()->AppendInt(static_cast<uint32_t>(aStatus),
|
||||
16);
|
||||
uint16_t code = NS_ERROR_GET_CODE(NS_ERROR_FAILURE);
|
||||
rv = bundle->FormatStringFromID(code, otherArgArray, result);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStringBundleService::FormatStatusMessage(nsresult aStatus,
|
||||
const char16_t* aStatusArg,
|
||||
nsAString& result) {
|
||||
uint32_t i, argCount = 0;
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
|
||||
// XXX hack for mailnews who has already formatted their messages:
|
||||
if (aStatus == NS_OK && aStatusArg) {
|
||||
result.Assign(aStatusArg);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aStatus == NS_OK) {
|
||||
return NS_ERROR_FAILURE; // no message to format
|
||||
}
|
||||
|
||||
// format the arguments:
|
||||
const nsDependentString args(aStatusArg);
|
||||
argCount = args.CountChar(char16_t('\n')) + 1;
|
||||
NS_ENSURE_ARG(argCount <= 10); // enforce 10-parameter limit
|
||||
AutoTArray<nsString, 10> argArray;
|
||||
|
||||
// convert the aStatusArg into an nsString array
|
||||
if (argCount == 1) {
|
||||
argArray.AppendElement(aStatusArg);
|
||||
} else if (argCount > 1) {
|
||||
int32_t offset = 0;
|
||||
for (i = 0; i < argCount; i++) {
|
||||
int32_t pos = args.FindChar('\n', offset);
|
||||
if (pos == -1) pos = args.Length();
|
||||
argArray.AppendElement(Substring(args, offset, pos - offset));
|
||||
offset = pos + 1;
|
||||
}
|
||||
}
|
||||
|
||||
switch (NS_ERROR_GET_MODULE(aStatus)) {
|
||||
case NS_ERROR_MODULE_XSLT:
|
||||
getStringBundle(XSLT_MSGS_URL, getter_AddRefs(bundle));
|
||||
break;
|
||||
default:
|
||||
getStringBundle(GLOBAL_PROPERTIES, getter_AddRefs(bundle));
|
||||
break;
|
||||
}
|
||||
|
||||
return FormatWithBundle(bundle, aStatus, argArray, result);
|
||||
}
|
||||
|
||||
@@ -47,11 +47,6 @@ class nsStringBundleService : public nsIStringBundleService,
|
||||
private:
|
||||
virtual ~nsStringBundleService();
|
||||
|
||||
void getStringBundle(const char* aUrl, nsIStringBundle** aResult);
|
||||
nsresult FormatWithBundle(nsIStringBundle* bundle, nsresult aStatus,
|
||||
const nsTArray<nsString>& argArray,
|
||||
nsAString& result);
|
||||
|
||||
void flushBundleCache(bool ignoreShared = true);
|
||||
|
||||
mozilla::UniquePtr<bundleCacheEntry_t> evictOneEntry();
|
||||
|
||||
Reference in New Issue
Block a user