Closed Bug 361334 Opened 15 years ago Closed 15 years ago

Onbeforeunload dialog has too many line breaks

Categories

(Core :: Layout, defect)

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: martijn.martijn, Assigned: martijn.martijn)

References

Details

(Keywords: regression, testcase)

Attachments

(4 files, 1 obsolete file)

This changed with my patch for bug 317334, so this is a problem on 1.8.1 branch too.
There used to be 2 line breaks shown in the onbeforunload dialog, but with the check in of my patch for bug 317334, the dialog shows 4 line breaks.

I think this is easy to fix in:
http://lxr.mozilla.org/seamonkey/source/layout/base/nsDocumentViewer.cpp#1197
Attached file testcase
Attached patch patch (obsolete) — Splinter Review
This fixes it.
I'm kinda curious of what StringHead(event.text, len) should give. It doesn't seem to give any text at all. Is there a situation when it has any text?
Attachment #246097 - Flags: superreview?(jst)
Attachment #246097 - Flags: review?(jst)
Comment on attachment 246097 [details] [diff] [review]
patch

event.text gets set if the beforeunload event handler sets event.returnValue (or returns a string value, if regsitered with window.onbeforeunload).

r+sr=jst
Attachment #246097 - Flags: superreview?(jst)
Attachment #246097 - Flags: superreview+
Attachment #246097 - Flags: review?(jst)
Attachment #246097 - Flags: review+
Comment on attachment 246097 [details] [diff] [review]
patch

Ah, thanks, in that case this patch is no good, because the message would get at the same line as the top message.
Attachment #246097 - Attachment is obsolete: true
Attachment #246093 - Attachment is patch: false
Attachment #246093 - Attachment mime type: text/plain → text/html
Attached patch patchv2Splinter Review
So something like this?
Attachment #246130 - Flags: superreview?(jst)
Attachment #246130 - Flags: review?(jst)
Component: General → Layout
QA Contact: general → layout
Comment on attachment 246130 [details] [diff] [review]
patchv2

Sure, r+sr=jst
Attachment #246130 - Flags: superreview?(jst)
Attachment #246130 - Flags: superreview+
Attachment #246130 - Flags: review?(jst)
Attachment #246130 - Flags: review+
Checking in nsDocumentViewer.cpp;
/cvsroot/mozilla/layout/base/nsDocumentViewer.cpp,v  <--  nsDocumentViewer.cpp
new revision: 1.499; previous revision: 1.498
done

Checked in on trunk.
Assignee: nobody → martijn.martijn
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Comment on attachment 246130 [details] [diff] [review]
patchv2

>Index: layout/base/nsDocumentViewer.cpp

>+      nsAutoString msg;
>+      if (len == 0) {
>+        msg = preMsg + StringHead(event.text, len) +
>+              NS_LITERAL_STRING("\n\n") + postMsg;

What's the point of including event.text if you know its length is 0?
Attached patch patchSplinter Review
> What's the point of including event.text if you know its length is 0?

You're right, there is no point in that, that was an oversight of me.
Attachment #246226 - Flags: superreview?(jst)
Attachment #246226 - Flags: review?(jst)
Attachment #246226 - Flags: superreview?(jst)
Attachment #246226 - Flags: superreview+
Attachment #246226 - Flags: review?(jst)
Attachment #246226 - Flags: review+
Checking in nsDocumentViewer.cpp;
/cvsroot/mozilla/layout/base/nsDocumentViewer.cpp,v  <--  nsDocumentViewer.cpp
new revision: 1.500; previous revision: 1.499
done

Checked the patch in from comment 10, thanks Gavin.
You need to log in before you can comment on or make changes to this bug.