mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-30 01:59:29 +00:00
The first fix reverses the way xpinstall aborts/cleans up itself. The correct way is to undo the commands it ran in backwards order. The second fixes problem with a install.js script not having called finalizeInstall() yet still installing files.
This commit is contained in:
parent
0e326d49bf
commit
ffb8aa030f
@ -238,7 +238,7 @@ nsInstall::InternalAbort(PRInt32 errcode)
|
||||
nsInstallObject* ie;
|
||||
if (mInstalledFiles != nsnull)
|
||||
{
|
||||
for (PRInt32 i=0; i < mInstalledFiles->Count(); i++)
|
||||
for (PRInt32 i=mInstalledFiles->Count() - 1; i >= 0; i--)
|
||||
{
|
||||
ie = (nsInstallObject *)mInstalledFiles->ElementAt(i);
|
||||
if (ie)
|
||||
|
@ -254,9 +254,11 @@ class nsInstall
|
||||
void SetInstallURL(const nsString& url);
|
||||
|
||||
PRBool GetStatusSent() { return mStatusSent; }
|
||||
PRBool InInstallTransaction(void) { return mInstalledFiles != nsnull; }
|
||||
|
||||
PRInt32 Alert(nsString& string);
|
||||
PRInt32 Confirm(nsString& string, PRBool* aReturn);
|
||||
void InternalAbort(PRInt32 errcode);
|
||||
|
||||
|
||||
|
||||
@ -305,7 +307,6 @@ class nsInstall
|
||||
PRBool BadRegName(const nsString& regName);
|
||||
PRInt32 SaveError(PRInt32 errcode);
|
||||
|
||||
void InternalAbort(PRInt32 errcode);
|
||||
void CleanUp();
|
||||
|
||||
PRInt32 OpenJARFile(void);
|
||||
|
@ -49,7 +49,8 @@ enum Install_slots
|
||||
INSTALL_ARGUMENTS = -6,
|
||||
INSTALL_URL = -7,
|
||||
INSTALL_STATUSSENT = -8,
|
||||
INSTALL_INSTALL = -9
|
||||
INSTALL_INSTALL = -9,
|
||||
INSTALL_INSTALLED_FILES = -10
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
@ -133,6 +134,10 @@ GetInstallProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
*vp = OBJECT_TO_JSVAL(obj);
|
||||
break;
|
||||
|
||||
case INSTALL_INSTALLED_FILES:
|
||||
*vp = BOOLEAN_TO_JSVAL( a->InInstallTransaction() );
|
||||
break;
|
||||
|
||||
default:
|
||||
return JS_TRUE;
|
||||
}
|
||||
@ -2489,6 +2494,7 @@ static JSPropertySpec InstallProperties[] =
|
||||
{"url", INSTALL_URL, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"_statusSent", INSTALL_STATUSSENT, JSPROP_READONLY},
|
||||
{"Install", INSTALL_INSTALL, JSPROP_READONLY},
|
||||
{"_installedFiles", INSTALL_INSTALLED_FILES, JSPROP_READONLY},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
@ -348,6 +348,7 @@ extern "C" void RunInstallOnThread(void *data)
|
||||
{
|
||||
// Go ahead and run!!
|
||||
jsval rval;
|
||||
jsval installedFiles;
|
||||
|
||||
PRBool ok = JS_EvaluateScript( cx,
|
||||
glob,
|
||||
@ -357,24 +358,36 @@ extern "C" void RunInstallOnThread(void *data)
|
||||
0,
|
||||
&rval);
|
||||
|
||||
if (!ok)
|
||||
|
||||
if(!ok)
|
||||
{
|
||||
// problem compiling or running script
|
||||
if(JS_GetProperty(cx, glob, "_installedFiles", &installedFiles) &&
|
||||
JSVAL_TO_BOOLEAN(installedFiles))
|
||||
{
|
||||
nsInstall *a = (nsInstall*)JS_GetPrivate(cx, glob);
|
||||
a->InternalAbort(nsInstall::SCRIPT_ERROR);
|
||||
}
|
||||
|
||||
finalStatus = nsInstall::SCRIPT_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
// check to make sure the script sent back a status
|
||||
jsval sent;
|
||||
|
||||
if(JS_GetProperty(cx, glob, "_installedFiles", &installedFiles) &&
|
||||
JSVAL_TO_BOOLEAN(installedFiles))
|
||||
{
|
||||
nsInstall *a = (nsInstall*)JS_GetPrivate(cx, glob);
|
||||
a->InternalAbort(nsInstall::SCRIPT_ERROR);
|
||||
}
|
||||
|
||||
if ( JS_GetProperty( cx, glob, "_statusSent", &sent ) &&
|
||||
JSVAL_TO_BOOLEAN(sent) )
|
||||
{
|
||||
sendStatus = PR_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
finalStatus = nsInstall::SCRIPT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
JS_DestroyContext(cx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user