Ticket #4234: updateDriver.patch

File updateDriver.patch, 2.8 KB (added by gk, 7 years ago)
  • toolkit/xre/nsUpdateDriver.cpp

    diff -r 381310995e75 toolkit/xre/nsUpdateDriver.cpp
    a b ApplyUpdate(nsIFile *greDir, nsIFile *up 
    367367 
    368368  nsCAutoString updaterPath;
    369369  rv = updater->GetNativePath(updaterPath);
    370370  if (NS_FAILED(rv))
    371371    return;
    372372
    373373#endif
    374374
    375   // Get the directory to which the update will be applied. On Mac OSX we need
    376   // to apply the update to the Foo.app directory which is the parent of the
    377   // parent of the appDir. On other platforms we will just apply to the appDir.
    378 #if defined(XP_MACOSX)
     375  // Get the directory to which the update will be applied. For JonDoBrowser we
     376  // need to apply the update to the parent of the parent of the appDir.
    379377  nsCAutoString applyToDir;
    380   {
    381     nsCOMPtr<nsIFile> parentDir1, parentDir2;
    382     rv = appDir->GetParent(getter_AddRefs(parentDir1));
    383     if (NS_FAILED(rv))
    384       return;
    385     rv = parentDir1->GetParent(getter_AddRefs(parentDir2));
    386     if (NS_FAILED(rv))
    387       return;
    388     rv = parentDir2->GetNativePath(applyToDir);
    389   }
    390 #elif defined(XP_WIN)
     378  nsCOMPtr<nsIFile> parentDir1, parentDir2;
     379  rv = appDir->GetParent(getter_AddRefs(parentDir1));
     380  if (NS_FAILED(rv))
     381    return;
     382  rv = parentDir1->GetParent(getter_AddRefs(parentDir2));
     383  if (NS_FAILED(rv))
     384    return;
     385#if defined(XP_WIN)
    391386  nsAutoString applyToDirW;
    392   rv = appDir->GetPath(applyToDirW);
     387  rv = parentDir2->GetPath(applyToDirW);
    393388
    394389  NS_ConvertUTF16toUTF8 applyToDir(applyToDirW);
    395 #else
    396   nsCAutoString applyToDir;
    397   rv = appDir->GetNativePath(applyToDir);
    398 #endif
     390#else
     391  rv = parentDir2->GetNativePath(applyToDir);
     392#endif
    399393  if (NS_FAILED(rv))
    400394    return;
    401395
    402396#if defined(XP_WIN)
    403397  nsAutoString updateDirPathW;
    404398  rv = updateDir->GetPath(updateDirPathW);
    405399
    406400  NS_ConvertUTF16toUTF8 updateDirPath(updateDirPathW);
    ProcessUpdates(nsIFile *greDir, nsIFile  
    528522      NS_ADDREF(appDir = overrideDir);
    529523    }
    530524  }
    531525
    532526  nsCOMPtr<nsILocalFile> statusFile;
    533527  if (GetStatusFile(updatesDir, statusFile) &&
    534528      IsPending(statusFile)) {
    535529    nsCOMPtr<nsILocalFile> versionFile;
    536     // Remove the update if the update application version file doesn't exist
    537     // or if the update's application version is less than the current
    538     // application version.
    539     if (!GetVersionFile(updatesDir, versionFile) ||
     530    // Remove the update if the JonDoBrowser update version file doesn't exist
     531    // or if the update's JonDoBrowser version is less than the current
     532    // JonDoBrowser version.
     533    /*if (!GetVersionFile(updatesDir, versionFile) ||
    540534        IsOlderVersion(versionFile, appVersion)) {
    541535      updatesDir->Remove(true);
    542     } else {
     536    } else {*/
    543537      ApplyUpdate(greDir, updatesDir, statusFile, appDir,
    544538                  argc, argv);
    545     }
     539    //}
    546540  }
    547541
    548542  return NS_OK;
    549543}