Closed Bug 133754 Opened 22 years ago Closed 22 years ago

nsWindowWatcher.cpp uses AssignWithConversion

Categories

(Core :: DOM: Navigation, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla1.2beta

People

(Reporter: Biesinger, Assigned: smontagu)

References

Details

(Keywords: intl, Whiteboard: [browser])

Attachments

(1 file)

AssignWithConversion is used in nsWindowWatcher.cpp; it should, instead, use
NS_ConvertUTF8toUCS2.
-> danm
Assignee: adamlock → danm
.
Target Milestone: --- → mozilla1.2alpha
This is causing the "Reset Master Password" functionality to not work in
translated versions which translate the InternalToken string in
pipnss.properties to a string which contains non-ASCII characters. In
mozilla/security/manager/pki/resources/content/pref-masterpass.js,
internal_token.tokenName is passed via window.open to
mozilla/security/manager/pki/resources/content/resetpassword.js. In
resetpassword.js, the tokenName is then passed to findTokenByName. In our
internal testing, we found that the tokenName parameter was being corrupted via
the AssignWithConversion call in nsWindowWatcher::OpenWindowJS. After changing
the usage of AssignWithConversion to NS_ConvertUTF8toUCS2, the problem was fixed.

This problem can be reproduced in the French translated version of Netscape 7.
Severity: normal → major
OS: Linux → All
Hardware: PC → All
Target Milestone: mozilla1.2alpha → mozilla1.2beta
How can we be so sure that aName has to be UTF-8
AssignWithConversion is definitely wrong. But I am not sure treat it as UTF8 is
right neither. 
We should look at the api. Why we use char* here instead of PRUnichar* for aName?
reassign this to simon montagu.
Simon. Please work with danm about this issue. 
Assignee: danm → smontagu
Blocks: 157673
cc. rchen
If you look at the code that calls this function, it shows the UTF8 stuff.

Here is the call from nsGlobalWindow:

http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsGlobalWindow.cpp#4295

name is explicitly set with ToNewUTF8String

The other calls I can find call ww->OpenWindow with "_blank" explicitly as the name
Comment on attachment 101456 [details] [diff] [review]
AssignWithConversion -> NS_ConvertUTF8toUCS2

It would have been nicer to change the API to use a Unicode string rather than
doing a double conversion, but since the interface is frozen, this seems to be
the way to go.
r=smontagu
Attachment #101456 - Flags: review+
Keywords: intl, nsbeta1
This is a problem too in the JA 11/05 build. I can not use the Reset Password
button.
adding nsbeta1+
Keywords: nsbeta1nsbeta1+
Whiteboard: [browser]
Any update on this one?
Attachment #101456 - Flags: superreview?(alecf)
Comment on attachment 101456 [details] [diff] [review]
AssignWithConversion -> NS_ConvertUTF8toUCS2

Ok, just make sure this is really UTF8 here! (are you sure it isn't the native
charset?)
Attachment #101456 - Flags: superreview?(alecf) → superreview+
>just make sure this is really UTF8 here!

See comment 8 
Checked in:

Checking in nsWindowWatcher.cpp;
/cvsroot/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp,v 
<--  nsWindowWatcher.cpp
new revision: 1.69; previous revision: 1.68
done
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
No longer blocks: 157673
Depends on: 180372
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: