Allow empty message parameters passed to CefJSDialogHandler.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@699 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2012-06-20 19:44:45 +00:00
parent 1ed3ac28b4
commit 93e1f9722b
3 changed files with 9 additions and 35 deletions

View File

@ -53,7 +53,7 @@ class CefJSDialogHandler : public virtual CefBase {
// Called to run a JavaScript alert message. Return false to display the // Called to run a JavaScript alert message. Return false to display the
// default alert or true if you displayed a custom alert. // default alert or true if you displayed a custom alert.
/// ///
/*--cef()--*/ /*--cef(optional_param=message)--*/
virtual bool OnJSAlert(CefRefPtr<CefBrowser> browser, virtual bool OnJSAlert(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, CefRefPtr<CefFrame> frame,
const CefString& message) { return false; } const CefString& message) { return false; }
@ -63,7 +63,7 @@ class CefJSDialogHandler : public virtual CefBase {
// default alert or true if you displayed a custom alert. If you handled the // default alert or true if you displayed a custom alert. If you handled the
// alert set |retval| to true if the user accepted the confirmation. // alert set |retval| to true if the user accepted the confirmation.
/// ///
/*--cef()--*/ /*--cef(optional_param=message)--*/
virtual bool OnJSConfirm(CefRefPtr<CefBrowser> browser, virtual bool OnJSConfirm(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, CefRefPtr<CefFrame> frame,
const CefString& message, const CefString& message,
@ -75,7 +75,7 @@ class CefJSDialogHandler : public virtual CefBase {
// the prompt set |retval| to true if the user accepted the prompt and request // the prompt set |retval| to true if the user accepted the prompt and request
// and |result| to the resulting value. // and |result| to the resulting value.
/// ///
/*--cef()--*/ /*--cef(optional_param=message,optional_param=defaultValue)--*/
virtual bool OnJSPrompt(CefRefPtr<CefBrowser> browser, virtual bool OnJSPrompt(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, CefRefPtr<CefFrame> frame,
const CefString& message, const CefString& message,

View File

@ -33,10 +33,7 @@ int CEF_CALLBACK jsdialog_handler_on_jsalert(
DCHECK(frame); DCHECK(frame);
if (!frame) if (!frame)
return 0; return 0;
// Verify param: message; type: string_byref_const // Unverified params: message
DCHECK(message);
if (!message)
return 0;
// Execute // Execute
bool _retval = CefJSDialogHandlerCppToC::Get(self)->OnJSAlert( bool _retval = CefJSDialogHandlerCppToC::Get(self)->OnJSAlert(
@ -64,14 +61,11 @@ int CEF_CALLBACK jsdialog_handler_on_jsconfirm(
DCHECK(frame); DCHECK(frame);
if (!frame) if (!frame)
return 0; return 0;
// Verify param: message; type: string_byref_const
DCHECK(message);
if (!message)
return 0;
// Verify param: retval; type: bool_byref // Verify param: retval; type: bool_byref
DCHECK(retval); DCHECK(retval);
if (!retval) if (!retval)
return 0; return 0;
// Unverified params: message
// Translate param: retval; type: bool_byref // Translate param: retval; type: bool_byref
bool retvalBool = (retval && *retval)?true:false; bool retvalBool = (retval && *retval)?true:false;
@ -108,14 +102,6 @@ int CEF_CALLBACK jsdialog_handler_on_jsprompt(
DCHECK(frame); DCHECK(frame);
if (!frame) if (!frame)
return 0; return 0;
// Verify param: message; type: string_byref_const
DCHECK(message);
if (!message)
return 0;
// Verify param: defaultValue; type: string_byref_const
DCHECK(defaultValue);
if (!defaultValue)
return 0;
// Verify param: retval; type: bool_byref // Verify param: retval; type: bool_byref
DCHECK(retval); DCHECK(retval);
if (!retval) if (!retval)
@ -124,6 +110,7 @@ int CEF_CALLBACK jsdialog_handler_on_jsprompt(
DCHECK(result); DCHECK(result);
if (!result) if (!result)
return 0; return 0;
// Unverified params: message, defaultValue
// Translate param: retval; type: bool_byref // Translate param: retval; type: bool_byref
bool retvalBool = (retval && *retval)?true:false; bool retvalBool = (retval && *retval)?true:false;

View File

@ -32,10 +32,7 @@ bool CefJSDialogHandlerCToCpp::OnJSAlert(CefRefPtr<CefBrowser> browser,
DCHECK(frame.get()); DCHECK(frame.get());
if (!frame.get()) if (!frame.get())
return false; return false;
// Verify param: message; type: string_byref_const // Unverified params: message
DCHECK(!message.empty());
if (message.empty())
return false;
// Execute // Execute
int _retval = struct_->on_jsalert(struct_, int _retval = struct_->on_jsalert(struct_,
@ -62,10 +59,7 @@ bool CefJSDialogHandlerCToCpp::OnJSConfirm(CefRefPtr<CefBrowser> browser,
DCHECK(frame.get()); DCHECK(frame.get());
if (!frame.get()) if (!frame.get())
return false; return false;
// Verify param: message; type: string_byref_const // Unverified params: message
DCHECK(!message.empty());
if (message.empty())
return false;
// Translate param: retval; type: bool_byref // Translate param: retval; type: bool_byref
int retvalInt = retval; int retvalInt = retval;
@ -100,14 +94,7 @@ bool CefJSDialogHandlerCToCpp::OnJSPrompt(CefRefPtr<CefBrowser> browser,
DCHECK(frame.get()); DCHECK(frame.get());
if (!frame.get()) if (!frame.get())
return false; return false;
// Verify param: message; type: string_byref_const // Unverified params: message, defaultValue
DCHECK(!message.empty());
if (message.empty())
return false;
// Verify param: defaultValue; type: string_byref_const
DCHECK(!defaultValue.empty());
if (defaultValue.empty())
return false;
// Translate param: retval; type: bool_byref // Translate param: retval; type: bool_byref
int retvalInt = retval; int retvalInt = retval;