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)
Tracking
(Not tracked)
VERIFIED
FIXED
mozilla0.9.6
People
(Reporter: cmanske, Assigned: cmanske)
Details
(Whiteboard: EDITORBASE)
Attachments
(1 file, 2 obsolete files)
10.50 KB,
patch
|
bzbarsky
:
review+
kinmoz
:
superreview+
|
Details | Diff | Splinter Review |
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.
Assignee | ||
Updated•24 years ago
|
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
Assignee | ||
Comment 1•24 years ago
|
||
Assignee | ||
Comment 2•24 years ago
|
||
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.
Assignee | ||
Comment 3•24 years ago
|
||
Assignee | ||
Updated•24 years ago
|
Attachment #55160 -
Attachment is obsolete: true
Assignee | ||
Comment 4•24 years ago
|
||
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.
Assignee | ||
Comment 6•24 years ago
|
||
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.
Assignee | ||
Updated•24 years ago
|
Attachment #55247 -
Attachment is obsolete: true
Assignee | ||
Comment 7•24 years ago
|
||
Assignee | ||
Comment 8•24 years ago
|
||
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+
Assignee | ||
Updated•24 years ago
|
Whiteboard: EDITORBASE, FIX IN HAND, need r=,sr= → EDITORBASE, FIX IN HAND, need r=
Assignee | ||
Comment 10•24 years ago
|
||
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 11•24 years ago
|
||
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+
Assignee | ||
Comment 12•24 years ago
|
||
checked in
Assignee | ||
Comment 13•24 years ago
|
||
Rechecked all the "getAttribute" calls to verify
Status: RESOLVED → VERIFIED
Updated•21 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•