removed unnecessary if statements
This commit is contained in:
dprice%netscape.com 2001-12-07 07:50:09 +00:00
Родитель 45b92fe8f8
Коммит 63cd1b5206
3 изменённых файлов: 27 добавлений и 74 удалений

Просмотреть файл

@ -849,23 +849,14 @@ InstallFinalizeInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
return JS_TRUE;
}
if(argc >= 0)
{
jsrefcount saveDepth;
saveDepth = JS_SuspendRequest(cx);//Need to suspend use of thread or deadlock occurs
// public int FinalizeInstall (void);
nsresult rv = nativeThis->FinalizeInstall(&nativeRet);
JS_ResumeRequest(cx, saveDepth);
if (NS_FAILED(rv))
return JS_FALSE;
jsrefcount saveDepth;
saveDepth = JS_SuspendRequest(cx);//Need to suspend use of thread or deadlock occurs
// public int FinalizeInstall (void);
nsresult rv = nativeThis->FinalizeInstall(&nativeRet);
JS_ResumeRequest(cx, saveDepth);
if (NS_SUCCEEDED(rv))
*rval = INT_TO_JSVAL(nativeRet);
}
else
{
JS_ReportError(cx, "Function FinalizeInstall requires 0 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
@ -1102,22 +1093,11 @@ InstallGetLastError(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
return JS_TRUE;
}
if(argc >= 0)
{
// public int GetLastError (void);
if(NS_OK != nativeThis->GetLastError(&nativeRet))
{
return JS_FALSE;
}
// public int GetLastError (void);
if(NS_OK == nativeThis->GetLastError(&nativeRet)) {
*rval = INT_TO_JSVAL(nativeRet);
}
else
{
JS_ReportError(cx, "Function GetLastError requires 0 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
@ -1184,18 +1164,11 @@ InstallGetWinRegistry(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
return JS_TRUE;
}
if(argc >= 0)
// public int GetWinRegistry (void);
if(NS_OK != nativeThis->GetWinRegistry(cx, &WinRegClass, rval))
{
// public int GetWinRegistry (void);
if(NS_OK != nativeThis->GetWinRegistry(cx, &WinRegClass, rval))
{
return JS_FALSE;
}
}
else
{
JS_ReportError(cx, "Function GetWinRegistry requires 0 parameters");
return JS_FALSE;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
return JSVAL_NULL;
}
#endif
@ -1668,7 +1641,6 @@ InstallAlert(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
jsrefcount saveDepth = JS_SuspendRequest(cx);//Need to suspend use of thread or deadlock occurs
nativeThis->Alert(b0);
JS_ResumeRequest(cx, saveDepth);
}

Просмотреть файл

@ -132,27 +132,16 @@ PR_STATIC_CALLBACK(JSBool)
InstallTriggerGlobalUpdateEnabled(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMInstallTriggerGlobal *nativeThis = (nsIDOMInstallTriggerGlobal*)JS_GetPrivate(cx, obj);
PRBool nativeRet;
PRBool nativeRet = PR_FALSE;
*rval = JSVAL_NULL;
*rval = JSVAL_FALSE;
if (nsnull == nativeThis && (JS_FALSE == CreateNativeObject(cx, obj, &nativeThis)) )
return JS_FALSE;
return JS_TRUE;
if (argc >= 0) {
if (NS_OK != nativeThis->UpdateEnabled(&nativeRet)) {
return JS_FALSE;
}
*rval = BOOLEAN_TO_JSVAL(nativeRet);
}
else {
JS_ReportError(cx, "Function UpdateEnabled requires 0 parameters");
return JS_FALSE;
}
return JS_TRUE;
nativeThis->UpdateEnabled(&nativeRet);
*rval = BOOLEAN_TO_JSVAL(nativeRet);
return JS_TRUE;
}
//

Просмотреть файл

@ -330,25 +330,17 @@ InstallVersionToString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
return JS_TRUE;
}
if (argc >= 0) {
if (NS_OK != nativeThis->ToString(nativeRet)) {
return JS_FALSE;
}
JSString *jsstring =
JS_NewUCStringCopyN(cx, NS_REINTERPRET_CAST(const jschar*,
nativeRet.get()),
nativeRet.Length());
// set the return value
*rval = STRING_TO_JSVAL(jsstring);
}
else {
JS_ReportError(cx, "Function toString requires 0 parameters");
return JS_FALSE;
if (NS_OK != nativeThis->ToString(nativeRet)) {
return JS_TRUE;
}
JSString *jsstring =
JS_NewUCStringCopyN(cx, NS_REINTERPRET_CAST(const jschar*,
nativeRet.get()),
nativeRet.Length());
// set the return value
*rval = STRING_TO_JSVAL(jsstring);
return JS_TRUE;
}