} else { return nsJSUtils::nsReportError(cx, obj, result); } break; } case WINDOW_CONTROLLERS: { rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_CONTROLLERS, PR_FALSE); if (NS_FAILED(rv)) { return nsJSUtils::nsReportError(cx, obj, rv); } nsIControllers* prop; nsresult result = NS_OK; result = a->GetControllers(&prop); if (NS_SUCCEEDED(result)) {  nsJSUtils::nsConvertXPCObjectToJSVal(prop, NS_GET_IID(nsIControllers), cx, obj, vp);
GetWindowProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp){  nsIDOMWindow *a = (nsIDOMWindow*)nsJSUtils::nsGetNativeThis(cx, obj);  // If there's no private data, this must be the prototype, so ignore  if (nsnull == a) {    return JS_TRUE;  }  if (JSVAL_IS_INT(id)) {    nsresult rv;    NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,                    NS_SCRIPTSECURITYMANAGER_PROGID, &rv);    if (NS_FAILED(rv)) {      return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);    }    switch(JSVAL_TO_INT(id)) {      case WINDOW_WINDOW:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_WINDOW, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMWindow* prop;        nsresult result = NS_OK;        result = a->GetWindow(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_SELF:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_SELF, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMWindow* prop;        nsresult result = NS_OK;        result = a->GetSelf(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_DOCUMENT:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_DOCUMENT, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMDocument* prop;        nsresult result = NS_OK;        result = a->GetDocument(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_NAVIGATOR:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_NAVIGATOR, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMNavigator* prop;        nsresult result = NS_OK;        result = a->GetNavigator(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_SCREEN:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_SCREEN, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMScreen* prop;        nsresult result = NS_OK;        result = a->GetScreen(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_HISTORY:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_HISTORY, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMHistory* prop;        nsresult result = NS_OK;        result = a->GetHistory(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_PARENT:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_PARENT, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMWindow* prop;        nsresult result = NS_OK;        result = a->GetParent(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_TOP:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_TOP, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMWindow* prop;        nsresult result = NS_OK;        result = a->GetTop(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_CONTENT:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_CONTENT, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMWindow* prop;        nsresult result = NS_OK;        result = a->GetContent(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_SIDEBAR:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_SIDEBAR, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsISidebar* prop;        nsresult result = NS_OK;        result = a->GetSidebar(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object; n.b., this will do a release on 'prop'          nsJSUtils::nsConvertXPCObjectToJSVal(prop, NS_GET_IID(nsISidebar), cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_MENUBAR:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_MENUBAR, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMBarProp* prop;        nsresult result = NS_OK;        result = a->GetMenubar(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_TOOLBAR:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_TOOLBAR, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMBarProp* prop;        nsresult result = NS_OK;        result = a->GetToolbar(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_LOCATIONBAR:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_LOCATIONBAR, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMBarProp* prop;        nsresult result = NS_OK;        result = a->GetLocationbar(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_PERSONALBAR:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_PERSONALBAR, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMBarProp* prop;        nsresult result = NS_OK;        result = a->GetPersonalbar(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_STATUSBAR:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_STATUSBAR, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMBarProp* prop;        nsresult result = NS_OK;        result = a->GetStatusbar(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_SCROLLBARS:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_SCROLLBARS, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMBarProp* prop;        nsresult result = NS_OK;        result = a->GetScrollbars(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_DIRECTORIES:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_DIRECTORIES, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMBarProp* prop;        nsresult result = NS_OK;        result = a->GetDirectories(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_CLOSED:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_CLOSED, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        PRBool prop;        nsresult result = NS_OK;        result = a->GetClosed(&prop);        if (NS_SUCCEEDED(result)) {          *vp = BOOLEAN_TO_JSVAL(prop);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_FRAMES:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_FRAMES, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMWindowCollection* prop;        nsresult result = NS_OK;        result = a->GetFrames(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_CONTROLLERS:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_CONTROLLERS, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIControllers* prop;        nsresult result = NS_OK;        result = a->GetControllers(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object; n.b., this will do a release on 'prop'          nsJSUtils::nsConvertXPCObjectToJSVal(prop, NS_GET_IID(nsIControllers), cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_OPENER:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_OPENER, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsIDOMWindow* prop;        nsresult result = NS_OK;        result = a->GetOpener(&prop);        if (NS_SUCCEEDED(result)) {          // get the js object          nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_STATUS:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_STATUS, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsAutoString prop;        nsresult result = NS_OK;        result = a->GetStatus(prop);        if (NS_SUCCEEDED(result)) {          nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_DEFAULTSTATUS:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_DEFAULTSTATUS, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsAutoString prop;        nsresult result = NS_OK;        result = a->GetDefaultStatus(prop);        if (NS_SUCCEEDED(result)) {          nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_NAME:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_NAME, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        nsAutoString prop;        nsresult result = NS_OK;        result = a->GetName(prop);        if (NS_SUCCEEDED(result)) {          nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_INNERWIDTH:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_INNERWIDTH, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        PRInt32 prop;        nsresult result = NS_OK;        result = a->GetInnerWidth(&prop);        if (NS_SUCCEEDED(result)) {          *vp = INT_TO_JSVAL(prop);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_INNERHEIGHT:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_INNERHEIGHT, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        PRInt32 prop;        nsresult result = NS_OK;        result = a->GetInnerHeight(&prop);        if (NS_SUCCEEDED(result)) {          *vp = INT_TO_JSVAL(prop);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_OUTERWIDTH:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_OUTERWIDTH, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        PRInt32 prop;        nsresult result = NS_OK;        result = a->GetOuterWidth(&prop);        if (NS_SUCCEEDED(result)) {          *vp = INT_TO_JSVAL(prop);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_OUTERHEIGHT:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_OUTERHEIGHT, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        PRInt32 prop;        nsresult result = NS_OK;        result = a->GetOuterHeight(&prop);        if (NS_SUCCEEDED(result)) {          *vp = INT_TO_JSVAL(prop);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_SCREENX:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_SCREENX, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        PRInt32 prop;        nsresult result = NS_OK;        result = a->GetScreenX(&prop);        if (NS_SUCCEEDED(result)) {          *vp = INT_TO_JSVAL(prop);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_SCREENY:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_SCREENY, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        PRInt32 prop;        nsresult result = NS_OK;        result = a->GetScreenY(&prop);        if (NS_SUCCEEDED(result)) {          *vp = INT_TO_JSVAL(prop);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_PAGEXOFFSET:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_PAGEXOFFSET, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        PRInt32 prop;        nsresult result = NS_OK;        result = a->GetPageXOffset(&prop);        if (NS_SUCCEEDED(result)) {          *vp = INT_TO_JSVAL(prop);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_PAGEYOFFSET:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_PAGEYOFFSET, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        PRInt32 prop;        nsresult result = NS_OK;        result = a->GetPageYOffset(&prop);        if (NS_SUCCEEDED(result)) {          *vp = INT_TO_JSVAL(prop);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_SCROLLX:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_SCROLLX, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        PRInt32 prop;        nsresult result = NS_OK;        result = a->GetScrollX(&prop);        if (NS_SUCCEEDED(result)) {          *vp = INT_TO_JSVAL(prop);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case WINDOW_SCROLLY:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_SCROLLY, PR_FALSE);        if (NS_FAILED(rv)) {          return nsJSUtils::nsReportError(cx, obj, rv);        }        PRInt32 prop;        nsresult result = NS_OK;        result = a->GetScrollY(&prop);        if (NS_SUCCEEDED(result)) {          *vp = INT_TO_JSVAL(prop);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      default:        return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);    }  }  else {    return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);  }  return PR_TRUE;}