Example #1
0
static JSBool
js_message(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
  const char *message;
  JSBool ok, cancel;
  int r;

  if(!JS_ConvertArguments(cx, argc, argv, "sbb", &message, &ok, &cancel))
    return JS_FALSE;

  r = message_popup(message, 
		    (ok     ? MESSAGE_POPUP_OK : 0) |
		    (cancel ? MESSAGE_POPUP_CANCEL : 0) | 
		    MESSAGE_POPUP_RICH_TEXT, NULL);

  switch(r) {
  case MESSAGE_POPUP_OK:
    *rval = BOOLEAN_TO_JSVAL(JS_TRUE);
    break;
  case MESSAGE_POPUP_CANCEL:
    *rval = BOOLEAN_TO_JSVAL(JS_FALSE);
    break;
  default:
    *rval = INT_TO_JSVAL(r);
    break;
  }
  return JS_TRUE;
}
Example #2
0
static JSBool
js_message(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
  const char *message;
  JSBool ok, cancel;
  int r;

  if(!JS_ConvertArguments(cx, argc, argv, "sbb", &message, &ok, &cancel))
    return JS_FALSE;

  r = message_popup(message, 
		    (ok     ? MESSAGE_POPUP_OK : 0) |
		    (cancel ? MESSAGE_POPUP_CANCEL : 0) | 
		    MESSAGE_POPUP_RICH_TEXT);


  *rval = BOOLEAN_TO_JSVAL(r == MESSAGE_POPUP_OK);
  return JS_TRUE;
}