[Pkg-mozext-commits] [firebug] 07/59: Issue 6710 (Issues with locales containing quotes) https://code.google.com/p/fbug/issues/detail?id=6710
David Prévot
taffit at moszumanska.debian.org
Thu Aug 14 14:52:53 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository firebug.
commit 3e406cad9bb9c546d2e5829c7aae1c6aa47ce17e
Author: Sebastian Zartner <sebastianzartner at gmail.com>
Date: Mon Jul 7 02:08:08 2014 +0200
Issue 6710 (Issues with locales containing quotes)
https://code.google.com/p/fbug/issues/detail?id=6710
Part 2: Escape double quotes within attributes in Domplate
---
extension/content/firebug/lib/domplate.js | 5 ++++-
extension/modules/locale.js | 22 ++++++++--------------
2 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/extension/content/firebug/lib/domplate.js b/extension/content/firebug/lib/domplate.js
index df72a6b..4cb69f3 100644
--- a/extension/content/firebug/lib/domplate.js
+++ b/extension/content/firebug/lib/domplate.js
@@ -866,7 +866,10 @@ function parseParts(str)
// No matches found at all so we return the whole string
if (!index)
- return str;
+ {
+ // Double quotes in strings need to be escaped (see issue 6710)
+ return str.replace('"', '\\"', "g");
+ }
// If we have data after our last matched index we append it here as the final step
var post = str.substr(index);
diff --git a/extension/modules/locale.js b/extension/modules/locale.js
index b2f7a81..9734714 100644
--- a/extension/modules/locale.js
+++ b/extension/modules/locale.js
@@ -72,9 +72,9 @@ Locale.$STR = function(name, bundle)
try
{
if (bundle)
- return validate(bundle.getString(strKey));
+ return bundle.getString(strKey);
else
- return validate(Locale.getStringBundle().GetStringFromName(strKey));
+ return Locale.getStringBundle().GetStringFromName(strKey);
}
catch (err)
{
@@ -88,7 +88,7 @@ Locale.$STR = function(name, bundle)
// The en-US string should be always available.
var defaultBundle = Locale.getDefaultStringBundle();
if (defaultBundle)
- return validate(defaultBundle.GetStringFromName(strKey));
+ return defaultBundle.GetStringFromName(strKey);
}
catch (err)
{
@@ -114,9 +114,9 @@ Locale.$STRF = function(name, args, bundle)
try
{
if (bundle)
- return validate(bundle.getFormattedString(strKey, args));
+ return bundle.getFormattedString(strKey, args);
else
- return validate(Locale.getStringBundle().formatStringFromName(strKey, args, args.length));
+ return Locale.getStringBundle().formatStringFromName(strKey, args, args.length);
}
catch (err)
{
@@ -130,7 +130,7 @@ Locale.$STRF = function(name, args, bundle)
// The en-US string should be always available.
var defaultBundle = Locale.getDefaultStringBundle();
if (defaultBundle)
- return validate(defaultBundle.formatStringFromName(strKey, args, args.length));
+ return defaultBundle.formatStringFromName(strKey, args, args.length);
}
catch (err)
{
@@ -168,10 +168,10 @@ Locale.$STRP = function(name, args, index, bundle)
// Get proper plural form from the string (depends on the current Firefox locale).
var translatedString = Locale.$STRF(name, args, bundle);
if (translatedString.search(";") > 0)
- return validate(getPluralForm(args[index], translatedString));
+ return getPluralForm(args[index], translatedString);
// translatedString contains no ";", either rule 0 or getString fails
- return validate(translatedString);
+ return translatedString;
};
/*
@@ -318,12 +318,6 @@ Locale.getFormattedKey = function(win, modifiers, key, keyConstant)
// ********************************************************************************************* //
// Helpers
-// Replace forbidden characters(see bug 6630)
-function validate(str)
-{
- return String(str).replace(/"/g, '\'');
-}
-
// This module needs to be independent of any other modules, so this is mainly a copy of
// Str.capitalize().
function capitalize(string)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git
More information about the Pkg-mozext-commits
mailing list