backing out myu fix for bug #375710, based on comments from kimura

This commit is contained in:
sspitzer@mozilla.org 2007-04-12 16:01:44 -07:00
parent 28e59734d6
commit e6cefb4316
2 changed files with 4 additions and 66 deletions

View File

@ -129,36 +129,6 @@ function openFileOutputStream(file, flags) {
return stream; return stream;
} }
/**
* Determine if a file is a child of another file. Needed because
* nsILocalFile.contains() has problems with short vs. long paths
* see bug #375710 for more details
*
* @param aParent (nsILocalFile)
* @param aChild (nsILocalFile)
* @return true if aChild is a child of aParent. Will also return
* true if aChild is same as aParent
*/
function canonicalRecursiveContains(aParent, aChild)
{
try {
var current = aChild;
while (current) {
if (aParent.equals(current))
return true;
var newCurrent = current.parent;
if (newCurrent.equals(current))
return false;
current = newCurrent;
}
}
catch (ex) {
}
return false;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
const PREFIX_FILE = "File: "; const PREFIX_FILE = "File: ";
@ -222,7 +192,7 @@ InstallLogWriter.prototype = {
.getService(Components.interfaces.nsIProperties); .getService(Components.interfaces.nsIProperties);
var programFilesDir = fileLocator.get(KEY_PROGRAMFILES, var programFilesDir = fileLocator.get(KEY_PROGRAMFILES,
Components.interfaces.nsILocalFile); Components.interfaces.nsILocalFile);
if (canonicalRecursiveContains(programFilesDir, updRoot)) { if (programFilesDir.contains(updRoot, true)) {
var relativePath = updRoot.QueryInterface(Components.interfaces.nsILocalFile). var relativePath = updRoot.QueryInterface(Components.interfaces.nsILocalFile).
getRelativeDescriptor(programFilesDir); getRelativeDescriptor(programFilesDir);
var userLocalDir = fileLocator.get(KEY_LOCALDATA, var userLocalDir = fileLocator.get(KEY_LOCALDATA,

View File

@ -217,38 +217,6 @@ function getUpdateDir(pathArray) {
return getDirInternal(KEY_APPDIR, pathArray, true, true); return getDirInternal(KEY_APPDIR, pathArray, true, true);
} }
#ifdef XP_WIN
/**
* Determine if a file is a child of another file. Needed because
* nsILocalFile.contains() has problems with short vs. long paths
* see bug #375710 for more details
*
* @param aParent (nsILocalFile)
* @param aChild (nsILocalFile)
* @return true if aChild is a child of aParent. Will also return
* true if aChild is same as aParent
*/
function canonicalRecursiveContains(aParent, aChild)
{
try {
var current = aChild;
while (current) {
if (aParent.equals(current))
return true;
var newCurrent = current.parent;
if (newCurrent.equals(current))
return false;
current = newCurrent;
}
}
catch (ex) {
}
return false;
}
#endif
/** /**
* Gets the specified directory at the speciifed hierarchy under a * Gets the specified directory at the speciifed hierarchy under a
* Directory Service key. * Directory Service key.
@ -274,7 +242,7 @@ function getDirInternal(key, pathArray, shouldCreate, update) {
if (update) { if (update) {
var programFilesDir = fileLocator.get(KEY_PROGRAMFILES, var programFilesDir = fileLocator.get(KEY_PROGRAMFILES,
Components.interfaces.nsILocalFile); Components.interfaces.nsILocalFile);
if (canonicalRecursiveContains(programFilesDir, dir)) { if (programFilesDir.contains(dir, true)) {
var relativePath = dir.getRelativeDescriptor(programFilesDir); var relativePath = dir.getRelativeDescriptor(programFilesDir);
var userLocalDir = fileLocator.get(KEY_LOCALDATA, var userLocalDir = fileLocator.get(KEY_LOCALDATA,
Components.interfaces.nsILocalFile).parent; Components.interfaces.nsILocalFile).parent;
@ -390,7 +358,7 @@ function getUpdatesDir(key) {
#ifdef XP_WIN #ifdef XP_WIN
var programFilesDir = fileLocator.get(KEY_PROGRAMFILES, var programFilesDir = fileLocator.get(KEY_PROGRAMFILES,
Components.interfaces.nsILocalFile); Components.interfaces.nsILocalFile);
if (canonicalRecursiveContains(programFilesDir, appDir)) { if (programFilesDir.contains(appDir, true)) {
var relativePath = appDir.getRelativeDescriptor(programFilesDir); var relativePath = appDir.getRelativeDescriptor(programFilesDir);
var userLocalDir = fileLocator.get(KEY_LOCALDATA, var userLocalDir = fileLocator.get(KEY_LOCALDATA,
Components.interfaces.nsILocalFile).parent; Components.interfaces.nsILocalFile).parent;
@ -2073,7 +2041,7 @@ Checker.prototype = {
// Always stop the current check // Always stop the current check
if (this._request) if (this._request)
this._request.abort(); this._request.abort();
const nsIUpdateChecker = Components.interfaces.nsIUpdateChecker; const nsIUpdateChecker = Components.interfaces.nsIUpdateChecker;
switch (duration) { switch (duration) {
case nsIUpdateChecker.CURRENT_SESSION: case nsIUpdateChecker.CURRENT_SESSION: