Closed Bug 84512 Opened 23 years ago Closed 23 years ago

document.write() of image tag throws script error

Categories

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

x86
All
defect

Tracking

()

RESOLVED FIXED
mozilla1.1alpha

People

(Reporter: bht237, Assigned: jst)

References

Details

(Keywords: ecommerce, testcase)

Attachments

(4 files)

BuildID:    2001053104

Detailed description will follow. Need this to have a reference for Quality 
Feedback Agent
Attaching testcase. The testcase itself does NOT crash - the crash occurs in
another page that I haven't managed to reduce to a testcase (time constraints!).

However, I guess that the complex page would NOT crash if the attached testcase
worked without the error.

The error is:
"[xpconnect wrapped Event]"
The error is displayed in an alert box from within function errorHandler(t,u,n).

This needs to be fixed because it corrupts error handlers AND crashes Mozilla!
Attached file HTML reproduces error
Priority: -- → P1
Confirming with 20010607xx nightly binaries on WinNT, Linux, Mac.
OS : Win95 --> All.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 95 → All
It is hard to debug a crash without know what's crashing or seeing it crash.

I'd bet you are looking at a DOM event problem rather than an xpconnect problem. 
It overloads the event scheme in order to do onerror handling. Dis you see some 
crash that led you to think it was crashing in xpconnect? Or was it just the 
"xpconnect wrapped Event" in the alert that led you to that? If the former then 
we'd need to reproduce the crash and see where and why. If the latter then 
xpconnect is not really implicated at all and this bug should be reassigned to 
joki@netscape.com who owns DOM event bugs for the speediest resolution.
John, was just going to cc you on this. I'm getting the alerts, but no crash. 
I'm going to try and pin down a stack trace at the alert box and see if that 
leads to anything
Status: NEW → ASSIGNED
Some of the other dynamics are that there are popup's firing due to timers while 
the xpconnect alert message is displayed. I'll attach a stack trace showing 
this. I've  slightly annotated the stack to show each alert text, look for the 
brackets.
This is kindof a known problem, alert's opened from DOM timers can pop up even
if there's a modal dialog currently open. Unless I missed something about
problems in XPConnect described in this bug this bug belongs to the DOM Level 0
component (i.e. to me)...
I agree that there is no evidence that an xpconnect bug exists here. I'm just 
going to be pushy and reassign it to jst as he suggested. The issue that I was 
unclear about is what in the testcase code is causing the onerror to fire. I was 
concerned that some other events where getting routed to the onerror handler 
path. That would be bad. I know we're already generally overloading the event 
scheme to do onerror. And that is bad enough. There is also a bug on joki's list 
somewhere about the fact that the other two spec'd params are not being properly 
passed to onerror handlers. I *really* would like us to find the time to fix 
this stuff as we settle into the new XPCDOM world.
Assignee: dbradley → jst
Status: ASSIGNED → NEW
Component: XPConnect → DOM Level 0
QA Contact: pschwartau → desale
The onerror bug that John refers to is probably bug 52120.

Although the initial description of THIS bug includes "crash", I suggest to
treat the crash (and the multiple dialogs) as secondary issues.
Primary issue IMHO is that onerror is fired, which can cause havoc in an
application that uses onerror for anything useful.

However, if the crash is also important to you then please get back to me and I
will try to get time to write a testcase.
I only got the crash because I used alerts to show the onerror events.
Keywords: testcase
I can't tell from the comments whether this is related, but the following page:

  http://www.kurzeilai.net/articles/art0134.html

produces an (apparently) endless stream of "xpconnect wrapped event" alerts.

Please feel free to open this as a separate bug if proper.
jst: It would be nice if those event object had toString methods so they 
wouldn'd print as "xpconnect wrapped event". Even always returning just 'Event' 
would be less ugly.
I'm unable to access kurzeilai.net, it's not getting resolved by my DNS server. 
Are you sure you got the URL correct?
jband: I don't see how adding a toString() method to Event's would solve any
problems, Event objects are just like any other DOM objects, if we add a
toString() method on Event objects we'd haveto add toString() methods to all our
DOM objects and that I *really* don't wanto do.
I can't see the benefit of toString() even in the scope of this bug but it is
likely that I miss something.
If I do

<html>
<script>
function init(){
    alert("Caller = "+init.caller);
}
</script>
</head>
<body onLoad="init()">
</body>
</html>

then I get "event", the same as in Netscape 4 so that's perfect.

To me it would be quite interesting to have error text, URL, line number, and
column number (yes, column number) in a window.onerror handler.

Anyway, thanks for your great work, Mozilla looks better every day :)
Sorry, my bad.  I dropped a "w" from the URL:

  http://www.kurzweilai.net/articles/art0134.html

Hope that helps.
Yes, that URL works, Scott. And it appears similar, if not the same. It's 
getting an alert box popped because an image failed to load.
Targetting for mozilla1.1
Target Milestone: --- → mozilla1.1
Testcase fails in Netscape Preview 6.1 (works fine in Netscape 6).

Are you sure that this should not be fixed earlier than mozilla1.1 ?
It's a very nasty bug that fouls up any error handler.
We would have to write separate Netscape 6.1 error handling code just for this bug.
Considering that this browser should make web page authoring easier, this is not
good for Netscape/Mozilla.
Attached file Basic minimal testcase
This garbage is unacceptable. Changed description. Added keywords.

Suppose a serious e-commerce site depends on JavaScript for its client-side
logic such as form validation.

Then it is fair to assume that this site does not simply ignore script errors.
So "window.onerror=null;" etc. is not an option.

In this case one must conclude that the Mozilla/Netscape browser is not fit for
e-commerce.

Why?

One cannot even work around this bug by filtering out the

"[xpconnect wrapped Event]"

"message" because the error handler gets passed this as an _object_ not having a
toString() method (instead of an error message string as usual).
Would someone please give this more attention and fix it.
Severity: critical → blocker
Summary: xpconnect wrapped Event javascript error then crash → document.write() of image tag throws script error
We are getting stuck with this because of bug 52120.
Both this and bug 52120 combined mean that error handling is completely corrupted.

The error thrown by this bug cannot be distinguished from a genuine error
because error message text is not yet implemented.

It means that applications fail without genuine errors if error handling is
enabled . Quite an unusual behavior for any software environment.

I thought that the Mozilla browser is targeting ecommerce applications but how
can that be achieved if such a basic prerequisite is broken?

Am I overlooking anything?

Is an acceptable workaround the use of document.createElement("image") and
node.appendChild(imageElement)?
Thanks for the workaround suggestion. It wouldn't work for us because of
cross-browser compatibility issues.
I hope that this bug is going to be fixed soon indirectly, as general js error
handling appears to be worked on at the moment -> bug 52120 ,-> bug 79133
Added dependencies so this can be closed more easily.
Depends on: 52120, 79133
build 2001120603 win32 seems to wfm

I'm guessing this is because bug 79133 is fixed. Is more investigation needed?
I don't think that ore investigation is needed. Should be closed I think.
Marking FIXED per bht and _basic's comments then, thanks :-)
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: