Closed Bug 490232 Opened 17 years ago Closed 17 years ago

L10n isn't escaped in .js files

Categories

(addons.mozilla.org Graveyard :: Public Pages, defect, P1)

defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: clouserw, Assigned: jbalogh)

Details

Attachments

(1 file, 2 obsolete files)

1) Load https://addons.mozilla.org/it/firefox/addon/4988 2) Note the JS error. It's because the locale uses single quotes in their string and this isn't being escaped.
I'd like to get this in for 5.0.5
Severity: normal → critical
Priority: -- → P1
Attached patch escape values (obsolete) — Splinter Review
Assignee: nobody → clouserw
Attachment #374685 - Flags: review?(jbalogh)
Comment on attachment 374685 [details] [diff] [review] escape values var addOnNotAvailableForPlatform = ""; _sanitizeArray escapes the param in place and doesn't return the escaped value, so everything comes out blank.
Attachment #374685 - Flags: review?(jbalogh) → review-
This one is closer, but not quite there because it breaks sprintf: var addOnNotAvailableForPlatform = "%1$s is not available for %2$s.";
Attachment #374685 - Attachment is obsolete: true
Attachment #374687 - Flags: review?(clouserw)
And it breaks inserting HTML: var app_compat_update_firefox = "<a href="http://getfirefox.com">Upgrade Firefox</a> to use this add-on"; It seems the _sanitizeArray hammer is not quite right in this case.
Assignee: clouserw → jbalogh
Yeah sanitizeArray is not a good idea for JS, it's HTML-escaping stuff. Just use addslashes.
It's different from the one I showed you, using backslashes instead of html entities because that doesn't play well with javascript.
Attachment #374687 - Attachment is obsolete: true
Attachment #374813 - Flags: review?(clouserw)
Attachment #374687 - Flags: review?(clouserw)
Attachment #374813 - Flags: review?(clouserw) → review+
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Verified FIXED: Loading https://addons.mozilla.org/it/firefox/addon/4988, I get: Error: missing ; before statement Source File: https://addons.mozilla.org/it/firefox/pages/js_constants.js Line: 30, Column: 25 Source Code: var devcp_js_add_email = 'Inserire l'indirizzo e-mail dell'autore da aggiungere.'; Loading https://preview.addons.mozilla.org/it/firefox/addon/4988, however, I don't see any errors.
Status: RESOLVED → VERIFIED
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: