Closed
Bug 153830
Opened 22 years ago
Closed 20 years ago
Mozilla 1.0's handling of null is different from IE, Netscape 4 and Netscape 6.
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla1.7final
People
(Reporter: shaohz, Assigned: jst)
Details
(Whiteboard: [HAVE FIX])
Attachments
(2 files)
69 bytes,
text/html
|
Details | |
1.78 KB,
patch
|
caillon
:
review+
peterv
:
superreview+
asa
:
approval1.7+
|
Details | Diff | Splinter Review |
Try the following JS code on IE, Netscape 4, Netscape 6 and Mozilla 1.0 {Build ID: 2002053012} var a=null; alert(a); var b="a="+a; alert(b); There are two alert boxes. On IE, Netscape 4 and Netscape 6 1) The first alert box shows null 2) The second alert box shows a=null On Mozilla 1.0 1) The first alert box shows NOTHING. 2) The second alert box shows a=null The difference has already caused errors in my code.
Comment 2•22 years ago
|
||
Reassigning to DOM Level 0, as this seems to be an issue with the alert() function itself. There is no such problem with the print() function in the standalone JS shell: js> var a = null; js> print(a); null js> var b="a="+a; js> print(b); a=null
Assignee: rogerl → jst
Component: JavaScript Engine → DOM Level 0
QA Contact: pschwartau → desale
Updated•22 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 3•22 years ago
|
||
Assignee | ||
Comment 4•22 years ago
|
||
Assignee | ||
Updated•22 years ago
|
Status: NEW → ASSIGNED
OS: Windows 2000 → All
Hardware: PC → All
Whiteboard: [HAVE FIX]
Target Milestone: --- → mozilla1.1beta
Reporter | ||
Comment 5•22 years ago
|
||
I found a similar null-related incompatibility problem in escape(). Try the following JS code on IE, Netscape 4, Netscape 6 and Mozilla 1.0 alert(typeof(escape(null))+'\n'+escape(null).length); On IE, Netscape 4 and Netscape 6, the alert box shows string 4 (escape(null) is 'null'.) But on Mozilla 1.0, the alert box shows string 0 (escape(null) is ''.)
Assignee | ||
Comment 6•22 years ago
|
||
You'll find this same difference in most methods that take string arguments. See bug 69468 for more details on this.
Assignee | ||
Updated•22 years ago
|
Target Milestone: mozilla1.1beta → mozilla1.3alpha
Comment 7•22 years ago
|
||
Comment on attachment 89037 [details] [diff] [review] Special handling of alert(null) to make it show "null" in the alert >- // XXX: Concatenation of optional args? >+ // This should be done with a const nsAString&, but compilers suck >+ // and can't deal with that :-( >+ const nsAString *str = DOMStringIsNull(aString) ? &null_str : &aString; I think you could do const nsAString& str = DOMStringIsNull(aString) ? NS_STATIC_CAST(const nsAString&, null_str) : aString; >@@ -5651,7 +5653,6 @@ > STRING_TO_JSVAL(::JS_InternString(cx, "preferenceinternal")); > } > >- NS_ENSURE_SUCCESS(rv, rv); > PRUint32 action; > if (argc == 1) { > action = nsIXPCSecurityManager::ACCESS_GET_PROPERTY; This change is obsolete I think.
Attachment #89037 -
Flags: superreview+
Assignee | ||
Updated•22 years ago
|
Target Milestone: mozilla1.3alpha → mozilla1.3final
Assignee | ||
Comment 8•21 years ago
|
||
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
Status: ASSIGNED → NEW
Comment 9•20 years ago
|
||
You have a patch and I sr'ed it with comments. Maybe you should check in? :-)
Assignee: general → jst
Assignee | ||
Comment 10•20 years ago
|
||
Comment on attachment 89037 [details] [diff] [review] Special handling of alert(null) to make it show "null" in the alert Hmm, yeah, I think I should :-) I've heard casting to references is potentially bad on some compilers (can cause copy ctors to be called n' what not), so I'll stay away from that. I just removed the comment where I was whining about it in stead :-)
Attachment #89037 -
Flags: review?(caillon)
Updated•20 years ago
|
Attachment #89037 -
Flags: review?(caillon) → review+
Assignee | ||
Updated•20 years ago
|
Status: NEW → ASSIGNED
Target Milestone: mozilla1.3final → mozilla1.7final
Assignee | ||
Comment 11•20 years ago
|
||
Comment on attachment 89037 [details] [diff] [review] Special handling of alert(null) to make it show "null" in the alert Trivial, and can help developers figure out what's going on. Requesting 1.7 approval.
Attachment #89037 -
Flags: approval1.7?
Comment 12•20 years ago
|
||
Comment on attachment 89037 [details] [diff] [review] Special handling of alert(null) to make it show "null" in the alert a=asa (on behalf of drivers) for checkin to 1.7
Attachment #89037 -
Flags: approval1.7? → approval1.7+
Assignee | ||
Comment 13•20 years ago
|
||
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•