added an installer for the debug plugin. Not part of build.

This commit is contained in:
dcone%netscape.com 2002-06-19 14:35:40 +00:00
Родитель 771b59029f
Коммит bd9c7e974a
2 изменённых файлов: 200 добавлений и 37 удалений

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

@ -0,0 +1,193 @@
// Name of the files to be installed
var PLUGIN_FILE = "npdebug.dll";
var COMPONENT_FILE = "npdebug.xpt";
var SERVICE_FILE = "abozo.txt";
//!!! VERY IMPORTANT TO UPDATE
var LD_MAJOR_VER = "0.5"; // Major minor version
var LD_VERSION = LD_MAJOR_VERSION = ".0.1"; // Append the buildnr to the major version
//!!! VERY IMPORTANT TO UPDATE
// The plug-in sise in kilobyte, both the dll and the xpi file. Used to check if there is enough space left on the clients harddisk
var PLUGIN_SIZE = 2000; // (DLL file) Reserve a little extra so it is not required to update too often
var COMPONENT_SIZE = 10; // (XPI file) Reserve a little extra so it is not required to update too often
var DEBUGDLL = 2000; // (DLL file) Reserve a little extra so it is not required to update too often
////////////////////////////////////////
// MAIN //
// main //
// M A I N //
////////////////////////////////////////
startLayoutDebugInstallation();
/**
* This function installs the Mozilla debug layout plugins.
* Must be called from installC3DPlugin
*
* @return true if the installation were successfull, false otherwise.
*/
function startLayoutDebugInstallation()
{
var err = initInstall("LayoutDebug Mozilla "+LD_MAJOR_VER, "Mozilla Debug Plugin", LD_VERSION);
logComment("Layout Debug initInstall: " + err);
if (err != SUCCESS) {
/// InitInstall failed. Couldn't even start to initialize the installation
alert("Initialization failed. Errorcode: "+err);
logComment("Layout Debug initInstall failed "+err);
cancelInstall(err);
return false;
}
// install the debug service
var componentsFolder = getFolder("components");
if ( verifyDiskSpace(componentsFolder, (DEBUGDLL)) == false ) {
// Insufficent disk space to install the plug-in
var errMsg = "Not enough space on harddisk to install the service";
alert(errMsg);
logComment("Layout Debug "+errMsg);
logComment("Layout Debug -- components folder diskspace: "+getAvailableDiskspace(componentsFolder));
cancelInstall(INSUFFICIENT_DISK_SPACE);
return false;
}
logComment("Enough space on harddisk to install the debug service");
if (!fileExists(componentsFolder)) {
var errMsg = "Missing the components directory("+componentsFolder+"). Errorcode "+err;
alert(errMsg);
LogComment("Layout Debug "+errMsg);
cancelInstall(err);
return false;
}
err = addFile(null, LD_VERSION, SERVICE_FILE, componentsFolder, null);
if (err != SUCCESS) {
alert("Installation of Layout-Debug Service failed. Error code "+err);
logComment("adding file "+SERVICE_FILE+" failed. Errror code: " + err);
cancelInstall(err);
return false;
}
// install the plugins and xlt files
var pluginsFolder = getFolder("Plugins");
logComment("Layout Debug pluginsFolder: " + pluginsFolder);
if ( verifyDiskSpace(pluginsFolder, (PLUGIN_SIZE+COMPONENT_SIZE)) == false ) {
// Insufficent disk space to install the plug-in
var errMsg = "Not enough space on harddisk to install the plug-in";
alert(errMsg);
logComment("Layout Debug "+errMsg);
logComment("Layout Debug -- Plugin folder diskspace: "+getAvailableDiskspace(pluginsFolder));
cancelInstall(INSUFFICIENT_DISK_SPACE);
return false;
}
logComment("Enough space on harddisk to install the plugin");
if (!fileExists(pluginsFolder)) {
err = dirCreate(pluginsFolder);
if (err != SUCCESS) {
var errMsg = "Could not create the missing plug-in directory("+pluginsFolder+"). Errorcode "+err;
alert(errMsg);
LogComment("Layout Debug "+errMsg);
cancelInstall(err);
return false;
}
}
err = addFile(null, LD_VERSION, PLUGIN_FILE, pluginsFolder, null);
if (err != SUCCESS) {
alert("Installation of Layout-Debug Plugin failed. Error code "+err);
logComment("Adding file "+PLUGIN_FILE+" failed. Errror code: " + err);
cancelInstall(err);
return false;
}
err = addFile(null,LD_VERSION, COMPONENT_FILE, pluginsFolder, null);
if (err != SUCCESS) {
alert("Installation of Layout-Debug xpt file failed. Error code "+err);
logComment("Layout Debug adding file "+COMPONENT_FILE+" failed. Error code: " + err);
cancelInstall(err);
return false;
}
logComment("Layout Debug performing installation");
err = performInstall();
logComment("Layout Debug plugin performInstall() returned: " + err);
if (err == REBOOT_NEEDED) {
var errMsg = "You need to reboot your computer in order for the installation to complete";
alert(errMsg);
logComment("Layout Debug "+errMsg);
}
if ((err != REBOOT_NEEDED) && (err != SUCCESS)) {
var errMsg = "Installation of Layout-Debug Plugin failed. (performInstall) ErrorCode: "+err;
alert(errMsg);
logComment("Layout Debug "+errMsg);
cancelInstall(err);
return false;
}
var succMsg = "Installation of Layout-Debug Plugin succeeded";
logComment("Layout Debug "+succMsg);
logComment("Layout Debug refreshing plugin info");
refreshPlugins();
return true;
}
/**
* this function verifies disk space in kilobytes
*
* @param dirPath The folder where to check if there is enough space
* @param spaceRequired The minimum pace that must be avaible for this test to be true
*
* @return true if there is enough diskspace return
* @return false if there isn't enough disk space
*/
function verifyDiskSpace(dirPath, spaceRequired)
{
// Get the available disk space on the given path
var spaceAvailable = fileGetDiskSpaceAvailable(dirPath);
// Convert the available disk space into kilobytes
spaceAvailable = parseInt(spaceAvailable / 1024);
// do the verification
if(spaceAvailable < spaceRequired) {
logComment("Layout Debug Insufficient disk space: " + dirPath);
logComment("Layout Debug required : " + spaceRequired + " K");
logComment("Layout Debug available: " + spaceAvailable + " K");
return (false);
}
return (true);
}
/**
* This function returns how many kilobytes are free in the specified folder
*
* @param dirPath The folder where to check if there is enough diskspace
*
* @return The amount of free diskspaces, expressed in kilobytes
*/
function getAvailableDiskspace(dirPath)
{
var spaceAvailable = fileGetDiskSpaceAvailable(dirPath);
return parseInt(spaceAvailable / 1024);
}

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

@ -130,26 +130,6 @@ function WriteOutput( aText, aReplace, aTextColor,aToStatus, aToOutPut )
//=============================================================================
function RestoreWindow()
{
if (changed) {
window.moveTo(origLeft,origTop);
window.resizeTo(origWidth,origHeight);
window.locationbar.visible = lb;
window.menubar.visible = mb;
window.personalbar.visible = pb;
window.scrollbars.visible = sb;
window.statusbar.visible = stb;
window.toolbar.visible = tb;
outputWindow.moveTo(origLeft,origTop);
outputWindow.resizeTo(origWidth,origHeight);
changed = false;
}
}
//=============================================================================
function placeWindows(aOutputWindow,aTestWindow)
{
// save old values, get rid of chrome and move and resize the windows
@ -174,13 +154,6 @@ function placeWindows(aOutputWindow,aTestWindow)
aOutputWindow.scrollbars.visible = false;
aOutputWindow.statusbar.visible = false;
aOutputWindow.toolbar.visible = false;
aTestWindow.locationbar.visible = false;
aTestWindow.menubar.visible = false;
aTestWindow.personalbar.visible = false;
aTestWindow.scrollbars.visible = false;
aTestWindow.statusbar.visible = false;
aTestWindow.toolbar.visible = false;
top = window.screen.availTop;
left = window.screen.availLeft;
@ -383,25 +356,25 @@ var loadingFlag;
<tr>
<td colspan="4">
<input id="ar" type="radio" name="dirTypes" value="runDirList" checked>
Run All Regression
All Regression
</td>
</tr>
<tr>
<td colspan="4">
<input id="tr" type="radio" name="dirTypes" value="runDirList" >
Run Table Regression
Table Regression
</td>
</tr>
<tr>
<td colspan="4">
<input id="br" type="radio" name="dirTypes" value="runDirList" >
Run Block Regression
Block Regression
</td>
</tr>
<tr>
<td colspan="4">
<input id="fcr" type="radio" name="dirTypes" value="runDirList" >
Run Form Controls Regression
Form Controls Regression
</td>
</tr>
</table>
@ -413,11 +386,11 @@ var loadingFlag;
<table width=800>
<tr>
<td>
Run Baseline
Generate Baseline
<input id="rb" type="radio" name="testType" value="runbaseline" checked >
</td>
<td>
Run Verify and Compare
Verify and Compare
<input id="rv" type="radio" name="testType" value="runverify" >
</td>
</tr>
@ -431,10 +404,7 @@ var loadingFlag;
<tr>
<td>
<input type=button value="Run Tests" onclick='runTests()'>
</td>
<td>
<input type=button value="RestoreBars" onclick='RestoreWindow()'>
<input type=button value="Execute" onclick='runTests()'>
</td>
</tr>
</table>