Closed Bug 106822 Opened 24 years ago Closed 24 years ago

Do not assume "getAttribute()" method will return an empty string

Categories

(SeaMonkey :: Composer, defect)

x86
Windows 2000
defect
Not set
major

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.9.6

People

(Reporter: cmanske, Assigned: cmanske)

Details

(Whiteboard: EDITORBASE)

Attachments

(1 file, 2 obsolete files)

Recent string code changes result in fundamental change in the "getAttribute()" method. It now returns null instead of an empty string. This caused bug 106733, and I have found 2 other instances of the pattern: if (foo.getAttribute("bar").toLowerCase() == ... in Composer code, that will cause JS exceptions. E.g., the HLine properties dialog no longer works because of this kind of error.
Severity: normal → major
Status: NEW → ASSIGNED
Summary: Do not assume "getAttribute()" method will return an empty string → Do not assume "getAttribute()" method will return an empty string
Whiteboard: EDITORBASE
Target Milestone: --- → mozilla0.9.6
There may be other more indirect instances of problems caused by null strings, but I suggest we checkin fixes as we find such problems ASAP, but keep the bug open for awhile to monitor potential problems.
Keywords: patch, review
Whiteboard: EDITORBASE → EDITORBASE, FIX IN HAND, need r=,sr=
Attachment #55160 - Attachment is obsolete: true
patch on 10/26/01 includes fix to editor.js for bug 106733, which is the same cause. CC'ing JST, who should do the SR for this.
named anchor dialog is also messed up on the trunk.
Note: 10/26/01 09:26 patch eliminates the '.trimString()' extension to the string class. It is now risky to use since the string can be null. We already had a standard "TrimString(inString)" method and that always returns an empty string instead of null, so that's what we should use from now on.
Attachment #55247 - Attachment is obsolete: true
With the patch from 10/26/01 10:17, all of Composer's dialogs and toolbars seem to work now, except for the "New" button problem in bug 106728, which I'm investigating separately.
Comment on attachment 55260 [details] [diff] [review] Minor tweak on last patch: Adjust for null return instead of empty string from getAttribute() sr=kin@netscape.com Thanks for doing the sweep.
Attachment #55260 - Flags: superreview+
Whiteboard: EDITORBASE, FIX IN HAND, need r=,sr= → EDITORBASE, FIX IN HAND, need r=
To help reviewers, here's the TrimString method: // Remove whitespace from both ends of a string function TrimString(string) { if (!string) return ""; return string.replace(/(^\s+)|(\s+$)/g, '') }
Comment on attachment 55260 [details] [diff] [review] Minor tweak on last patch: Adjust for null return instead of empty string from getAttribute() Looks good. r=bzbarsky
Attachment #55260 - Flags: review+
checked in
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Keywords: patch, review
Resolution: --- → FIXED
Whiteboard: EDITORBASE, FIX IN HAND, need r= → EDITORBASE
Rechecked all the "getAttribute" calls to verify
Status: RESOLVED → VERIFIED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: