| Index: chrome/browser/js_modal_dialog.cc
|
| diff --git a/chrome/browser/js_modal_dialog.cc b/chrome/browser/js_modal_dialog.cc
|
| index 5eb66a8ac02773a1c0f4387213b4199b5d4d5c10..2bfb8c852f6b6c82d48a89913b46571dd1aa389b 100644
|
| --- a/chrome/browser/js_modal_dialog.cc
|
| +++ b/chrome/browser/js_modal_dialog.cc
|
| @@ -4,12 +4,21 @@
|
|
|
| #include "chrome/browser/js_modal_dialog.h"
|
|
|
| +#include "base/string_util.h"
|
| #include "chrome/browser/extensions/extension_host.h"
|
| #include "chrome/browser/tab_contents/tab_contents.h"
|
| #include "chrome/common/notification_service.h"
|
| #include "chrome/common/notification_type.h"
|
| #include "ipc/ipc_message.h"
|
|
|
| +namespace {
|
| +
|
| +// The maximum sizes of various texts passed to us from javascript.
|
| +const int kMessageTextMaxSize = 3000;
|
| +const int kDefaultPromptTextSize = 2000;
|
| +
|
| +} // namespace
|
| +
|
| JavaScriptAppModalDialog::JavaScriptAppModalDialog(
|
| JavaScriptMessageBoxClient* client,
|
| const std::wstring& title,
|
| @@ -28,6 +37,12 @@ JavaScriptAppModalDialog::JavaScriptAppModalDialog(
|
| display_suppress_checkbox_(display_suppress_checkbox),
|
| is_before_unload_dialog_(is_before_unload_dialog),
|
| reply_msg_(reply_msg) {
|
| + // We trim the various parts of the message dialog because otherwise we can
|
| + // overflow the message dialog (and crash/hang the GTK+ version).
|
| + ElideString(message_text, kMessageTextMaxSize, &message_text_);
|
| + ElideString(default_prompt_text, kDefaultPromptTextSize,
|
| + &default_prompt_text_);
|
| +
|
| DCHECK((tab_contents_ != NULL) != (extension_host_ != NULL));
|
| InitNotifications();
|
| }
|
|
|