case XULDOCUMENT_CONTROLS: { rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULDOCUMENT_CONTROLS, PR_FALSE); if (NS_SUCCEEDED(rv)) { nsIDOMHTMLCollection* prop; rv = a->GetControls(&prop); if (NS_SUCCEEDED(rv)) {  nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp); } } break; }
GetXULDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp){  nsIDOMXULDocument *a = (nsIDOMXULDocument*)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 XULDOCUMENT_POPUPNODE:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULDOCUMENT_POPUPNODE, PR_FALSE);        if (NS_SUCCEEDED(rv)) {          nsIDOMNode* prop;          rv = a->GetPopupNode(&prop);          if (NS_SUCCEEDED(rv)) {            // get the js object            nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);          }        }        break;      }      case XULDOCUMENT_TOOLTIPNODE:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULDOCUMENT_TOOLTIPNODE, PR_FALSE);        if (NS_SUCCEEDED(rv)) {          nsIDOMNode* prop;          rv = a->GetTooltipNode(&prop);          if (NS_SUCCEEDED(rv)) {            // get the js object            nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);          }        }        break;      }      case XULDOCUMENT_COMMANDDISPATCHER:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULDOCUMENT_COMMANDDISPATCHER, PR_FALSE);        if (NS_SUCCEEDED(rv)) {          nsIDOMXULCommandDispatcher* prop;          rv = a->GetCommandDispatcher(&prop);          if (NS_SUCCEEDED(rv)) {            // get the js object            nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);          }        }        break;      }      case XULDOCUMENT_WIDTH:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULDOCUMENT_WIDTH, PR_FALSE);        if (NS_SUCCEEDED(rv)) {          PRInt32 prop;          rv = a->GetWidth(&prop);          if (NS_SUCCEEDED(rv)) {            *vp = INT_TO_JSVAL(prop);          }        }        break;      }      case XULDOCUMENT_HEIGHT:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULDOCUMENT_HEIGHT, PR_FALSE);        if (NS_SUCCEEDED(rv)) {          PRInt32 prop;          rv = a->GetHeight(&prop);          if (NS_SUCCEEDED(rv)) {            *vp = INT_TO_JSVAL(prop);          }        }        break;      }      case XULDOCUMENT_CONTROLS:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULDOCUMENT_CONTROLS, PR_FALSE);        if (NS_SUCCEEDED(rv)) {          nsIDOMHTMLCollection* prop;          rv = a->GetControls(&prop);          if (NS_SUCCEEDED(rv)) {            // get the js object            nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);          }        }        break;      }      default:        return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);    }  }  else {    return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);  }  if (NS_FAILED(rv))      return nsJSUtils::nsReportError(cx, obj, rv);  return PR_TRUE;}