case XULCOMMANDDISPATCHER_SUPPRESSFOCUS: { rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_SUPPRESSFOCUS, PR_TRUE); if (NS_SUCCEEDED(rv)) { PRBool prop; if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) { rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR; break; }  rv = a->SetSuppressFocus(prop);  } break; } case XULCOMMANDDISPATCHER_SUPPRESSFOCUSSCROLL: { rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_SUPPRESSFOCUSSCROLL, PR_TRUE); if (NS_SUCCEEDED(rv)) { PRBool prop; if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) { rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR; break; }  rv = a->SetSuppressFocusScroll(prop);  } break; } case XULCOMMANDDISPATCHER_ACTIVE: { rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_ACTIVE, PR_TRUE); if (NS_SUCCEEDED(rv)) { PRBool prop; if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) { rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR; break; }  rv = a->SetActive(prop);  } break; }
SetXULCommandDispatcherProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp){  nsIDOMXULCommandDispatcher *a = (nsIDOMXULCommandDispatcher*)nsJSUtils::nsGetNativeThis(cx, obj);  // If there's no private data, this must be the prototype, so ignore  if (nsnull == a) {    return JS_TRUE;  }  nsresult rv = NS_OK;  if (JSVAL_IS_INT(id)) {    nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);    if (!secMan)        return PR_FALSE;    switch(JSVAL_TO_INT(id)) {      case XULCOMMANDDISPATCHER_FOCUSEDELEMENT:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_FOCUSEDELEMENT, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          nsIDOMElement* prop;          if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,                                                  kIElementIID, NS_ConvertASCIItoUCS2("Element"),                                                  cx, *vp)) {            rv = NS_ERROR_DOM_NOT_OBJECT_ERR;            break;          }                rv = a->SetFocusedElement(prop);          NS_IF_RELEASE(prop);        }        break;      }      case XULCOMMANDDISPATCHER_FOCUSEDWINDOW:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_FOCUSEDWINDOW, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          nsIDOMWindowInternal* prop;          if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,                                                  kIWindowInternalIID, NS_ConvertASCIItoUCS2("WindowInternal"),                                                  cx, *vp)) {            rv = NS_ERROR_DOM_NOT_OBJECT_ERR;            break;          }                rv = a->SetFocusedWindow(prop);          NS_IF_RELEASE(prop);        }        break;      }      case XULCOMMANDDISPATCHER_SUPPRESSFOCUS:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_SUPPRESSFOCUS, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          PRBool prop;          if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {            rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;            break;          }                rv = a->SetSuppressFocus(prop);                  }        break;      }      case XULCOMMANDDISPATCHER_SUPPRESSFOCUSSCROLL:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_SUPPRESSFOCUSSCROLL, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          PRBool prop;          if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {            rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;            break;          }                rv = a->SetSuppressFocusScroll(prop);                  }        break;      }      case XULCOMMANDDISPATCHER_ACTIVE:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCOMMANDDISPATCHER_ACTIVE, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          PRBool prop;          if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {            rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;            break;          }                rv = a->SetActive(prop);                  }        break;      }      default:        return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);    }  }  else {    return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);  }  if (NS_FAILED(rv))      return nsJSUtils::nsReportError(cx, obj, rv);  return PR_TRUE;}