From cec937c8bb3f6b000bca1d6373080d445c61af30 Mon Sep 17 00:00:00 2001 From: "martijn.martijn%gmail.com" Date: Tue, 21 Nov 2006 23:57:21 +0000 Subject: [PATCH] Bug 361334 - Onbeforeunload dialog has too many line breaks, r+sr=jst --- layout/base/nsDocumentViewer.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index b2c04247aa1..269f28fb3bd 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -1194,9 +1194,15 @@ DocumentViewerImpl::PermitUnload(PRBool *aPermitUnload) // dialogue to 1024 characters. PRInt32 len = PR_MIN(event.text.Length(), 1024); - nsAutoString msg(preMsg + NS_LITERAL_STRING("\n\n") + - StringHead(event.text, len) + - NS_LITERAL_STRING("\n\n") + postMsg); + nsAutoString msg; + if (len == 0) { + msg = preMsg + StringHead(event.text, len) + + NS_LITERAL_STRING("\n\n") + postMsg; + } else { + msg = preMsg + NS_LITERAL_STRING("\n\n") + + StringHead(event.text, len) + + NS_LITERAL_STRING("\n\n") + postMsg; + } // This doesn't pass a title, which makes the title be // "Confirm", is that ok, or do we want a localizable title for