Closed Bug 58363 Opened 24 years ago Closed 23 years ago

wrong TimeBombURL returned in nsBrowserContentHandler::GetDefaultArgs(...)

Categories

(SeaMonkey :: UI Design, defect, P3)

defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: jag+mozbugs, Assigned: jag+mozilla)

References

()

Details

Attachments

(1 file)

2403         if ( expired ) 
2404         {
2405             char* urlString;
2406             rv = timeBomb->GetTimebombURL(&urlString);
2407             if ( NS_FAILED(rv) ) return rv;
2408 
2409             *aDefaultArgs =  nsXPIDLString::Copy(url);
2410             nsMemory::Free(urlString);
2411             return rv;
2412         }

The urlString is never used. Tracing this code's history explains why. It used
to be something like:

nsString url(urlString);
*aDefaultArgs = url.ToNewUnicode();

This was simplified to

*aDefaultArgs =  NS_ConvertASCIItoUCS2(url).ToNewUnicode();

Note the bogus |url| instead of |urlString|. This always gets us an empty string
instead of the TimeBombURL.

This change to the code was probably made because there already was a |url|
(compiler warnings), and the compile didn't fail because |url| already existed.
Because the other |url| is |nsXPIDLCString url;|, it was changed to use
nsXPIDLString::Copy(...).

Suggested fix:

-             *aDefaultArgs =  nsXPIDLString::Copy(url);
+             *aDefaultArgs =  NS_ConvertASCIItoUCS2(urlString).ToNewUnicode();

I'll attach a patch.
Adding keywords, changing summary slightly.
Keywords: patch, review
Summary: bug in nsBrowserContentHandler::GetDefaultArgs(...) → wrong TimeBombURL returned in nsBrowserContentHandler::GetDefaultArgs(...)
Mass move to jaggernaut@netscape.com
Assignee: jag → jaggernaut
resolving as fixed per jag
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
rubberstamp vrfy (unless you have a testcase for me to check :).
Status: RESOLVED → VERIFIED
Product: Core → Mozilla Application Suite
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: