Closed Bug 214050 Opened 22 years ago Closed 22 years ago

Localize CAPS more

Categories

(Core :: Security: CAPS, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: caillon, Assigned: caillon)

Details

Attachments

(2 files, 1 obsolete file)

Currently, it throws a bunch of custom security js exceptions using hardcoded strings which just so happen to be written in english. Localize these.
Attached patch Part 1 (obsolete) — Splinter Review
Gets the ball rolling. Fixes most, but not all, usages. The remaining ones I left because the strings are kind of sucky and I haven't thought of good replacement text for them.
Attachment #128622 - Flags: superreview?(bzbarsky)
Attachment #128622 - Flags: review?(bzbarsky)
Comment on attachment 128622 [details] [diff] [review] Part 1 >Index: caps/src/nsScriptSecurityManager.cpp >+ sStrBundle->FormatStringFromName(PromiseFlatString(stringName).get(), >+ formatStrings, stringName is already flat; just call .get() on it. > JS_SetPendingException(cx, >+ STRING_TO_JSVAL(JS_NewUCStringCopyZ(cx, >+ NS_REINTERPRET_CAST(const jschar*, errorMsg.get())))); So this allocates a new JSString*, gives ownership of it to a jsval*, which is passed to JS_SetPendingException... where does the dealloc happen? Figure this out, please. > JS_SetPendingException(cx, >+ STRING_TO_JSVAL(JS_NewUCStringCopyZ(cx, >+ NS_REINTERPRET_CAST(const jschar*, errorMsg.get())))); Same. (Different callsite) r+sr=me with that
Attachment #128622 - Flags: superreview?(bzbarsky)
Attachment #128622 - Flags: superreview+
Attachment #128622 - Flags: review?(bzbarsky)
Attachment #128622 - Flags: review+
After looking at the js engine code I was fairly confident that the string would be GC'd. I did double check with jst as requested who confirmed that. I made the PromiseFlatString change and checked in.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Attachment #128622 - Attachment is obsolete: true
Comment on attachment 128770 [details] [diff] [review] Supplemental patch I just landed this fix using the judgement that it was prudent to do so. I don't normally get after-the-fact reviews, but in light of the implications of this, I felt it best to land first to avoid security regressions in tomorrow's builds. This makes us continue to throw security exceptions where we need to, and not let the success of the string bundle call override that. I had done this elsewhere in the patch, I'm not sure why I missed this one caller. Anyway, please r+sr this supplementary patch when you can. Thanks.
Attachment #128770 - Flags: superreview?(bzbarsky)
Attachment #128770 - Flags: review?(bzbarsky)
Comment on attachment 128770 [details] [diff] [review] Supplemental patch r+sr=bzbarsky, but add a comment explaining the reasoning here.
Attachment #128770 - Flags: superreview?(bzbarsky)
Attachment #128770 - Flags: superreview+
Attachment #128770 - Flags: review?(bzbarsky)
Attachment #128770 - Flags: review+
Can not or Should not localize caps.properties ? (en-US/communicator/security/caps.properties) 1. Start Firefox Example: http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2004-02-21-08-trunk/ firefox-i686-pc-linux-gnu.tar.gz 2. Tools -> JavaScript console start 3. go http://www.google.co.jp/ 4. Error display in JavaScript Console. <*************> <*** en-US ***> <*************> Error: uncaught exception: [Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "chrome://browser/content/bookmarks/bookmarksMenu.js Line: 32"] <*************> <*** ja-JP ***> <*************> エラー: uncaught exception: [Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "chrome://browser/content/bookmarks/bookmarksMenu.js Line: 32"] 5. When you click "Reload current Page" button, Error display in JavaScript Cons ole. <*************> <*** en-US ***> <*************> Error: [Exception... "'Permission denied to get property XULElement.selectedIndex' when calling method: [nsIAutoCompletePopup::selectedIndex]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: http://www.google.co.jp/ :: <TOP_LEVEL> :: line 14" data: no] Source File: http://www.google.co.jp/ Line: 14 Error: [Exception... "'Permission denied to get property XULElement.selectedIndex' when calling method: [nsIAutoCompletePopup::selectedIndex]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: http://www.google.co.jp/ :: sf :: line 8" data: no] Source File: http://www.google.co.jp/ Line: 8 <*************> <*** ja-JP ***> <*************> Display unreadable message. When right-clicking, the pop-up "copy, When selecting error message in JavaScript Console and right-clicking, the pop-up "copy" can not copy.
Please file a separate bug for that.
(In reply to comment #9) > Please file a separate bug for that. caillon: Thanks, filed as bug 235811.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: