Closed Bug 296237 Opened 20 years ago Closed 18 years ago

remove assert in getElementById, use the console service to provide feedback

Categories

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

defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: mconnor, Assigned: asqueella)

References

Details

(Keywords: assertion)

Attachments

(2 files, 3 obsolete files)

document.getElementById("") asserts currently, and going into a "asserts crash" future, this would seem to be a Bad Thing. Instead of asserting, or a warning that's only of value to debug builds, we should output a message to the console service. Patch upcoming.
Assignee: general → mconnor
Status: NEW → ASSIGNED
Attachment #185033 - Flags: superreview?(jst)
Attachment #185033 - Flags: review?(jst)
Comment on attachment 185033 [details] [diff] [review] remove asserts, add console warning I guess it'd be nice to split this code into a global function (i.e. PRBool CheckGetElementByIdArg(const nsAString& aId)) in some file, say nsDocument.cpp and just call that from all these places. If not for code size, for easier code maintainability. r+sr=jst if you do that.
Attachment #185033 - Flags: superreview?(jst)
Attachment #185033 - Flags: superreview+
Attachment #185033 - Flags: review?(jst)
Attachment #185033 - Flags: review+
What's the status on this bug?
*** Bug 324151 has been marked as a duplicate of this bug. ***
Need to clean up and land this patch
Target Milestone: --- → mozilla1.9alpha
*** Bug 161855 has been marked as a duplicate of this bug. ***
Blocks: 344215
Keywords: assertion
Severity: normal → critical
Attached patch updated patch (obsolete) — Splinter Review
Attachment #185033 - Attachment is obsolete: true
Attachment #241640 - Flags: superreview?(jst)
Attachment #241640 - Flags: review?(jst)
(Need to fix the line endings before checking in.)
Assignee: mconnor → asqueella
Status: ASSIGNED → NEW
Comment on attachment 241640 [details] [diff] [review] updated patch - In nsDocument.cpp: +PRBool CheckGetElementByIdArg(const nsAString& aId) This should IMO be a static member method in the class nsDocument, it's only relevant to document objects. And put the return type declaration on its own line to follow the rest of the code around here. r+sr=jst with that fixed.
Attachment #241640 - Flags: superreview?(jst)
Attachment #241640 - Flags: superreview+
Attachment #241640 - Flags: review?(jst)
Attachment #241640 - Flags: review+
Fixed the review comment.
Attachment #241640 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Whiteboard: [checkin needed]
Checked in on trunk: Checking in base/src/nsDocument.cpp; /cvsroot/mozilla/content/base/src/nsDocument.cpp,v <-- nsDocument.cpp new revision: 3.685; previous revision: 3.684 done Checking in base/src/nsDocument.h; /cvsroot/mozilla/content/base/src/nsDocument.h,v <-- nsDocument.h new revision: 3.316; previous revision: 3.315 done Checking in html/document/src/nsHTMLDocument.cpp; /cvsroot/mozilla/content/html/document/src/nsHTMLDocument.cpp,v <-- nsHTMLDocu ment.cpp new revision: 3.698; previous revision: 3.697 done Checking in xml/document/src/nsXMLDocument.cpp; /cvsroot/mozilla/content/xml/document/src/nsXMLDocument.cpp,v <-- nsXMLDocumen t.cpp new revision: 1.250; previous revision: 1.249 done Checking in xul/document/src/nsXULDocument.cpp; /cvsroot/mozilla/content/xul/document/src/nsXULDocument.cpp,v <-- nsXULDocumen t.cpp new revision: 1.735; previous revision: 1.734 done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: [checkin needed]
why's this new message not localizable?
Because it wasn't localizable in mconnor's patch and I didn't remember it should be made localizable. I'll fix it.
Attached patch make the message localizable (obsolete) — Splinter Review
Attachment #242323 - Flags: superreview?(jst)
Attachment #242323 - Flags: review?(jst)
Comment on attachment 242323 [details] [diff] [review] make the message localizable nit re dom.properties, fix the newline? I'll let jst cover the nsDocument part.
Yes, biesi also mentioned it on IRC. I am going to fix it before the checkin.
Comment on attachment 242323 [details] [diff] [review] make the message localizable r+sr=jst with the missing newline added.
Attachment #242323 - Flags: superreview?(jst)
Attachment #242323 - Flags: superreview+
Attachment #242323 - Flags: review?(jst)
Attachment #242323 - Flags: review+
Attachment #242323 - Attachment is obsolete: true
Whiteboard: [checkin needed]
Attachment #242268 - Attachment description: patch v1.1 → patch v1.1 (checked in)
Comment on attachment 242708 [details] [diff] [review] make the message localizable, v1.1 Checked in on trunk: Checking in content/base/src/nsDocument.cpp; /cvsroot/mozilla/content/base/src/nsDocument.cpp,v <-- nsDocument.cpp new revision: 3.687; previous revision: 3.686 done Checking in dom/locales/en-US/chrome/dom/dom.properties; /cvsroot/mozilla/dom/locales/en-US/chrome/dom/dom.properties,v <-- dom.properties new revision: 1.7; previous revision: 1.6 done
Whiteboard: [checkin needed]
Component: DOM: Core → DOM: Core & HTML
QA Contact: ian → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: