Bug 401624: Remove support for install.js based xpi bundles. r=bsmedberg, a=schrep
--- a/toolkit/locales/en-US/chrome/global/xpinstall/xpinstall.properties
+++ b/toolkit/locales/en-US/chrome/global/xpinstall/xpinstall.properties
@@ -114,16 +114,17 @@ error-219=Invalid path
error-225=EXTRACTION_FAILED
error-227=Cancelled
error-228=Download error
error-229=Script error
error-230=Already exists
error-235=Out of space
error-239=Chrome registration failed
error-240=Unfinished install
+error-244=Unsupported package
error-260=Signing could not be verified.
error-261=Invalid file hash (possible download corruption)
error-262=Unknown or invalid file hash type
error-299=Out of memory
# there are other error codes, either rare or obsolete,
# that are not worth translating at this time.
unknown.error=Unexpected error %S
--- a/xpinstall/src/nsInstall.h
+++ b/xpinstall/src/nsInstall.h
@@ -209,16 +209,18 @@ class nsInstall
CHROME_REGISTRY_ERROR = -239,
MALFORMED_INSTALL = -240,
KEY_ACCESS_DENIED = -241,
KEY_DOES_NOT_EXIST = -242,
VALUE_DOES_NOT_EXIST = -243,
+ UNSUPPORTED_TYPE = -244,
+
INVALID_SIGNATURE = -260,
INVALID_HASH = -261,
INVALID_HASH_TYPE = -262,
OUT_OF_MEMORY = -299,
GESTALT_UNKNOWN_ERR = -5550,
GESTALT_INVALID_ARGUMENT = -5551,
--- a/xpinstall/src/nsSoftwareUpdateRun.cpp
+++ b/xpinstall/src/nsSoftwareUpdateRun.cpp
@@ -484,99 +484,98 @@ extern "C" void PR_CALLBACK RunInstallOn
{
rv = em->InstallItemFromFile(jarpath,
NS_INSTALL_LOCATION_APPPROFILE);
if (NS_FAILED(rv))
finalStatus = nsInstall::EXECUTION_ERROR;
} else {
finalStatus = nsInstall::UNEXPECTED_ERROR;
}
- // If install.rdf exists, but the install failed, we don't want
- // to try an install.js install.
- } else
-#endif
+ } else {
+ hZip->Close();
+ finalStatus = nsInstall::UNSUPPORTED_TYPE;
+ }
+#else
+ // If we're not a new toolkit app try XPInstall
+ finalStatus = GetInstallScriptFromJarfile( hZip,
+ &scriptBuffer,
+ &scriptLength);
+ if ( finalStatus == NS_OK && scriptBuffer )
{
- // If we're the suite, or there is no install.rdf,
- // try original XPInstall
- finalStatus = GetInstallScriptFromJarfile( hZip,
- &scriptBuffer,
- &scriptLength);
- if ( finalStatus == NS_OK && scriptBuffer )
- {
- // create our runtime
- rt = JS_NewRuntime(4L * 1024L * 1024L);
+ // create our runtime
+ rt = JS_NewRuntime(4L * 1024L * 1024L);
- rv = SetupInstallContext( hZip, jarpath,
- installInfo->GetURL(),
- installInfo->GetArguments(),
- installInfo->GetFlags(),
- installInfo->GetChromeRegistry(),
- rt, &cx, &glob);
+ rv = SetupInstallContext( hZip, jarpath,
+ installInfo->GetURL(),
+ installInfo->GetArguments(),
+ installInfo->GetFlags(),
+ installInfo->GetChromeRegistry(),
+ rt, &cx, &glob);
- if (NS_SUCCEEDED(rv))
- {
- // Go ahead and run!!
- jsval rval;
- jsval installedFiles;
- JS_BeginRequest(cx); //Increment JS thread counter associated
- //with this context
- PRBool ok = JS_EvaluateScript( cx,
- glob,
- scriptBuffer,
- scriptLength,
- nsnull,
- 0,
- &rval);
+ if (NS_SUCCEEDED(rv))
+ {
+ // Go ahead and run!!
+ jsval rval;
+ jsval installedFiles;
+ JS_BeginRequest(cx); //Increment JS thread counter associated
+ //with this context
+ PRBool ok = JS_EvaluateScript( cx,
+ glob,
+ scriptBuffer,
+ scriptLength,
+ nsnull,
+ 0,
+ &rval);
- if(!ok)
- {
- // problem compiling or running script -- a true SCRIPT_ERROR
- 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
+ if(!ok)
+ {
+ // problem compiling or running script -- a true SCRIPT_ERROR
+ if(JS_GetProperty(cx, glob, "_installedFiles", &installedFiles) &&
+ JSVAL_TO_BOOLEAN(installedFiles))
{
- // check to make sure the script sent back a status -- if
- // not the install may have been syntactically correct but
- // left the init/(perform|cancel) transaction open
+ nsInstall *a = (nsInstall*)JS_GetPrivate(cx, glob);
+ a->InternalAbort(nsInstall::SCRIPT_ERROR);
+ }
- if(JS_GetProperty(cx, glob, "_installedFiles", &installedFiles) &&
- JSVAL_TO_BOOLEAN(installedFiles))
- {
- // install items remain in queue, must clean up!
- nsInstall *a = (nsInstall*)JS_GetPrivate(cx, glob);
- a->InternalAbort(nsInstall::MALFORMED_INSTALL);
- }
-
- jsval sent;
- if ( JS_GetProperty( cx, glob, "_finalStatus", &sent ) )
- finalStatus = JSVAL_TO_INT(sent);
- else
- finalStatus = nsInstall::UNEXPECTED_ERROR;
- }
- JS_EndRequest(cx); //Decrement JS thread counter
- JS_DestroyContextMaybeGC(cx);
+ finalStatus = nsInstall::SCRIPT_ERROR;
}
else
{
- // couldn't initialize install context
- finalStatus = nsInstall::UNEXPECTED_ERROR;
- }
+ // check to make sure the script sent back a status -- if
+ // not the install may have been syntactically correct but
+ // left the init/(perform|cancel) transaction open
+
+ if(JS_GetProperty(cx, glob, "_installedFiles", &installedFiles) &&
+ JSVAL_TO_BOOLEAN(installedFiles))
+ {
+ // install items remain in queue, must clean up!
+ nsInstall *a = (nsInstall*)JS_GetPrivate(cx, glob);
+ a->InternalAbort(nsInstall::MALFORMED_INSTALL);
+ }
- // Clean up after ourselves.
- JS_DestroyRuntime(rt);
+ jsval sent;
+ if ( JS_GetProperty( cx, glob, "_finalStatus", &sent ) )
+ finalStatus = JSVAL_TO_INT(sent);
+ else
+ finalStatus = nsInstall::UNEXPECTED_ERROR;
+ }
+ JS_EndRequest(cx); //Decrement JS thread counter
+ JS_DestroyContextMaybeGC(cx);
}
+ else
+ {
+ // couldn't initialize install context
+ finalStatus = nsInstall::UNEXPECTED_ERROR;
+ }
+
+ // Clean up after ourselves.
+ JS_DestroyRuntime(rt);
}
+#endif
// force zip archive closed before other cleanup
hZip = 0;
}
if(listener)
listener->OnInstallDone( installInfo->GetURL(), finalStatus );
if (scriptBuffer) delete [] scriptBuffer;