Closed Bug 52724 Opened 24 years ago Closed 24 years ago

unused nsAutoString in nsHTMLDocument::CreateElement

Categories

(Core :: DOM: Core & HTML, defect, P2)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: dbaron, Assigned: jst)

Details

(Whiteboard: [nsbeta3+] dbaron, could you verify please?)

In nsHTMLDocument::CreateElement, I see the lines: 1427 nsAutoString tmp(aTagName); 1428 tmp.ToLowerCase(); The string |tmp| is not used again in the function. This is either: * a waste of two lines, and some string copying and munching * obscuring some other bug because you *should* have used tmp later on. I'm filing this bug to suggest that you either remove the two lines or use tmp somewhere else in the function, whichever is right. :-)
Ooohh, good catch David, tmp should be used, but in stead aTagName was used, this patch fixes the problem: Index: html/document/src/nsHTMLDocument.cpp =================================================================== RCS file: /cvsroot/mozilla/layout/html/document/src/nsHTMLDocument.cpp,v retrieving revision 3.283 diff -u -r3.283 nsHTMLDocument.cpp --- nsHTMLDocument.cpp 2000/09/19 05:11:59 3.283 +++ nsHTMLDocument.cpp 2000/09/19 07:39:35 @@ -1425,7 +1425,7 @@ nsAutoString tmp(aTagName); tmp.ToLowerCase(); - mNodeInfoManager->GetNodeInfo(aTagName, nsnull, kNameSpaceID_None, + mNodeInfoManager->GetNodeInfo(tmp, nsnull, kNameSpaceID_None, *getter_AddRefs(nodeInfo)); nsCOMPtr<nsIHTMLContent> content; Nominating nsbeta3, this makes document.createElement("a") and document.createElement("A") create elements that behave differently, and we don't want that. This is a trivial low risk fix.
Severity: minor → major
Status: NEW → ASSIGNED
Keywords: correctness, nsbeta3
Priority: P3 → P2
Target Milestone: --- → M18
Yes, this is a trivial, extremely low risk fix. Marking nsbeta3+
Whiteboard: [nsbeta3+]
Fixed
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
dbaron, could you verify please?
Whiteboard: [nsbeta3+] → [nsbeta3+] dbaron, could you verify please?
Status: RESOLVED → VERIFIED
Verified by looking at source
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.