gecko-dev/toolkit/mozapps/update/tests/shared.js
Robert Strong 93c8cfffb2 App update test only changes and build changes for tests. Reorganize app update test structure and remove unneeded Makefiles and moz.build files for Bug 929149. r=bbondy, r=gps for build changes
--HG--
rename : toolkit/mozapps/update/test/Makefile.in => toolkit/mozapps/update/tests/Makefile.in
rename : toolkit/mozapps/update/test/TestAUSHelper.cpp => toolkit/mozapps/update/tests/TestAUSHelper.cpp
rename : toolkit/mozapps/update/test/TestAUSReadStrings.cpp => toolkit/mozapps/update/tests/TestAUSReadStrings.cpp
rename : toolkit/mozapps/update/test/TestAUSReadStrings1.ini => toolkit/mozapps/update/tests/TestAUSReadStrings1.ini
rename : toolkit/mozapps/update/test/TestAUSReadStrings2.ini => toolkit/mozapps/update/tests/TestAUSReadStrings2.ini
rename : toolkit/mozapps/update/test/TestAUSReadStrings3.ini => toolkit/mozapps/update/tests/TestAUSReadStrings3.ini
rename : toolkit/mozapps/update/test/chrome/chrome.ini => toolkit/mozapps/update/tests/chrome/chrome.ini
rename : toolkit/mozapps/update/test/chrome/test_0011_check_basic.xul => toolkit/mozapps/update/tests/chrome/test_0011_check_basic.xul
rename : toolkit/mozapps/update/test/chrome/test_0012_check_basic_license.xul => toolkit/mozapps/update/tests/chrome/test_0012_check_basic_license.xul
rename : toolkit/mozapps/update/test/chrome/test_0013_check_incompat_basic.xul => toolkit/mozapps/update/tests/chrome/test_0013_check_incompat_basic.xul
rename : toolkit/mozapps/update/test/chrome/test_0014_check_incompat_basic_license.xul => toolkit/mozapps/update/tests/chrome/test_0014_check_incompat_basic_license.xul
rename : toolkit/mozapps/update/test/chrome/test_0015_check_incompat_basic_addons.xul => toolkit/mozapps/update/tests/chrome/test_0015_check_incompat_basic_addons.xul
rename : toolkit/mozapps/update/test/chrome/test_0016_check_incompat_basic_license_addons.xul => toolkit/mozapps/update/tests/chrome/test_0016_check_incompat_basic_license_addons.xul
rename : toolkit/mozapps/update/test/chrome/test_0017_check_staging_basic.xul => toolkit/mozapps/update/tests/chrome/test_0017_check_staging_basic.xul
rename : toolkit/mozapps/update/test/chrome/test_0021_check_billboard.xul => toolkit/mozapps/update/tests/chrome/test_0021_check_billboard.xul
rename : toolkit/mozapps/update/test/chrome/test_0022_check_billboard_license.xul => toolkit/mozapps/update/tests/chrome/test_0022_check_billboard_license.xul
rename : toolkit/mozapps/update/test/chrome/test_0023_check_incompat_billboard.xul => toolkit/mozapps/update/tests/chrome/test_0023_check_incompat_billboard.xul
rename : toolkit/mozapps/update/test/chrome/test_0024_check_incompat_billboard_license.xul => toolkit/mozapps/update/tests/chrome/test_0024_check_incompat_billboard_license.xul
rename : toolkit/mozapps/update/test/chrome/test_0025_check_incompat_billboard_addons.xul => toolkit/mozapps/update/tests/chrome/test_0025_check_incompat_billboard_addons.xul
rename : toolkit/mozapps/update/test/chrome/test_0026_check_incompat_billboard_license_addons.xul => toolkit/mozapps/update/tests/chrome/test_0026_check_incompat_billboard_license_addons.xul
rename : toolkit/mozapps/update/test/chrome/test_0031_available_basic.xul => toolkit/mozapps/update/tests/chrome/test_0031_available_basic.xul
rename : toolkit/mozapps/update/test/chrome/test_0032_available_basic_license.xul => toolkit/mozapps/update/tests/chrome/test_0032_available_basic_license.xul
rename : toolkit/mozapps/update/test/chrome/test_0033_available_incompat_basic.xul => toolkit/mozapps/update/tests/chrome/test_0033_available_incompat_basic.xul
rename : toolkit/mozapps/update/test/chrome/test_0034_available_incompat_basic_license.xul => toolkit/mozapps/update/tests/chrome/test_0034_available_incompat_basic_license.xul
rename : toolkit/mozapps/update/test/chrome/test_0035_available_incompat_basic_addons.xul => toolkit/mozapps/update/tests/chrome/test_0035_available_incompat_basic_addons.xul
rename : toolkit/mozapps/update/test/chrome/test_0036_available_incompat_basic_license_addons.xul => toolkit/mozapps/update/tests/chrome/test_0036_available_incompat_basic_license_addons.xul
rename : toolkit/mozapps/update/test/chrome/test_0041_available_billboard.xul => toolkit/mozapps/update/tests/chrome/test_0041_available_billboard.xul
rename : toolkit/mozapps/update/test/chrome/test_0042_available_billboard_license.xul => toolkit/mozapps/update/tests/chrome/test_0042_available_billboard_license.xul
rename : toolkit/mozapps/update/test/chrome/test_0043_available_incompat_billboard.xul => toolkit/mozapps/update/tests/chrome/test_0043_available_incompat_billboard.xul
rename : toolkit/mozapps/update/test/chrome/test_0044_available_incompat_billboard_license.xul => toolkit/mozapps/update/tests/chrome/test_0044_available_incompat_billboard_license.xul
rename : toolkit/mozapps/update/test/chrome/test_0045_available_incompat_billboard_addons.xul => toolkit/mozapps/update/tests/chrome/test_0045_available_incompat_billboard_addons.xul
rename : toolkit/mozapps/update/test/chrome/test_0046_available_incompat_billboard_license_addons.xul => toolkit/mozapps/update/tests/chrome/test_0046_available_incompat_billboard_license_addons.xul
rename : toolkit/mozapps/update/test/chrome/test_0051_check_error_xml_malformed.xul => toolkit/mozapps/update/tests/chrome/test_0051_check_error_xml_malformed.xul
rename : toolkit/mozapps/update/test/chrome/test_0052_check_no_updates.xul => toolkit/mozapps/update/tests/chrome/test_0052_check_no_updates.xul
rename : toolkit/mozapps/update/test/chrome/test_0053_check_billboard_license_noAttr.xul => toolkit/mozapps/update/tests/chrome/test_0053_check_billboard_license_noAttr.xul
rename : toolkit/mozapps/update/test/chrome/test_0054_check_billboard_license_404.xul => toolkit/mozapps/update/tests/chrome/test_0054_check_billboard_license_404.xul
rename : toolkit/mozapps/update/test/chrome/test_0061_check_verifyFailPartial_noComplete.xul => toolkit/mozapps/update/tests/chrome/test_0061_check_verifyFailPartial_noComplete.xul
rename : toolkit/mozapps/update/test/chrome/test_0062_check_verifyFailComplete_noPartial.xul => toolkit/mozapps/update/tests/chrome/test_0062_check_verifyFailComplete_noPartial.xul
rename : toolkit/mozapps/update/test/chrome/test_0063_check_verifyFailPartialComplete.xul => toolkit/mozapps/update/tests/chrome/test_0063_check_verifyFailPartialComplete.xul
rename : toolkit/mozapps/update/test/chrome/test_0064_check_verifyFailPartial_successComplete.xul => toolkit/mozapps/update/tests/chrome/test_0064_check_verifyFailPartial_successComplete.xul
rename : toolkit/mozapps/update/test/chrome/test_0071_notify_verifyFailPartial_noComplete.xul => toolkit/mozapps/update/tests/chrome/test_0071_notify_verifyFailPartial_noComplete.xul
rename : toolkit/mozapps/update/test/chrome/test_0072_notify_verifyFailComplete_noPartial.xul => toolkit/mozapps/update/tests/chrome/test_0072_notify_verifyFailComplete_noPartial.xul
rename : toolkit/mozapps/update/test/chrome/test_0073_notify_verifyFailPartialComplete.xul => toolkit/mozapps/update/tests/chrome/test_0073_notify_verifyFailPartialComplete.xul
rename : toolkit/mozapps/update/test/chrome/test_0074_notify_verifyFailPartial_successComplete.xul => toolkit/mozapps/update/tests/chrome/test_0074_notify_verifyFailPartial_successComplete.xul
rename : toolkit/mozapps/update/test/chrome/test_0081_error_patchApplyFailure_partial_only.xul => toolkit/mozapps/update/tests/chrome/test_0081_error_patchApplyFailure_partial_only.xul
rename : toolkit/mozapps/update/test/chrome/test_0082_error_patchApplyFailure_complete_only.xul => toolkit/mozapps/update/tests/chrome/test_0082_error_patchApplyFailure_complete_only.xul
rename : toolkit/mozapps/update/test/chrome/test_0083_error_patchApplyFailure_partial_complete.xul => toolkit/mozapps/update/tests/chrome/test_0083_error_patchApplyFailure_partial_complete.xul
rename : toolkit/mozapps/update/test/chrome/test_0084_error_patchApplyFailure_verify_failed.xul => toolkit/mozapps/update/tests/chrome/test_0084_error_patchApplyFailure_verify_failed.xul
rename : toolkit/mozapps/update/test/chrome/test_0091_installed.xul => toolkit/mozapps/update/tests/chrome/test_0091_installed.xul
rename : toolkit/mozapps/update/test/chrome/test_0092_finishedBackground.xul => toolkit/mozapps/update/tests/chrome/test_0092_finishedBackground.xul
rename : toolkit/mozapps/update/test/chrome/test_0093_restartNotification.xul => toolkit/mozapps/update/tests/chrome/test_0093_restartNotification.xul
rename : toolkit/mozapps/update/test/chrome/test_0094_restartNotification_remote.xul => toolkit/mozapps/update/tests/chrome/test_0094_restartNotification_remote.xul
rename : toolkit/mozapps/update/test/chrome/test_0095_restartNotification_remoteInvalidNumber.xul => toolkit/mozapps/update/tests/chrome/test_0095_restartNotification_remoteInvalidNumber.xul
rename : toolkit/mozapps/update/test/chrome/test_0096_restartNotification_stagedBackground.xul => toolkit/mozapps/update/tests/chrome/test_0096_restartNotification_stagedBackground.xul
rename : toolkit/mozapps/update/test/chrome/test_0097_restartNotification_stagedServiceBackground.xul => toolkit/mozapps/update/tests/chrome/test_0097_restartNotification_stagedServiceBackground.xul
rename : toolkit/mozapps/update/test/chrome/test_0101_background_restartNotification.xul => toolkit/mozapps/update/tests/chrome/test_0101_background_restartNotification.xul
rename : toolkit/mozapps/update/test/chrome/test_0102_background_restartNotification_staging.xul => toolkit/mozapps/update/tests/chrome/test_0102_background_restartNotification_staging.xul
rename : toolkit/mozapps/update/test/chrome/test_0103_background_restartNotification_stagingService.xul => toolkit/mozapps/update/tests/chrome/test_0103_background_restartNotification_stagingService.xul
rename : toolkit/mozapps/update/test/chrome/test_0111_neverButton_basic.xul => toolkit/mozapps/update/tests/chrome/test_0111_neverButton_basic.xul
rename : toolkit/mozapps/update/test/chrome/test_0112_neverButton_billboard.xul => toolkit/mozapps/update/tests/chrome/test_0112_neverButton_billboard.xul
rename : toolkit/mozapps/update/test/chrome/test_0113_showNeverForVersionRemovedWithPref.xul => toolkit/mozapps/update/tests/chrome/test_0113_showNeverForVersionRemovedWithPref.xul
rename : toolkit/mozapps/update/test/chrome/test_0121_check_requireBuiltinCert.xul => toolkit/mozapps/update/tests/chrome/test_0121_check_requireBuiltinCert.xul
rename : toolkit/mozapps/update/test/chrome/test_0122_check_allowNonBuiltinCert_validCertAttrs.xul => toolkit/mozapps/update/tests/chrome/test_0122_check_allowNonBuiltinCert_validCertAttrs.xul
rename : toolkit/mozapps/update/test/chrome/test_0123_check_allowNonBuiltinCert_noCertAttrsCheck.xul => toolkit/mozapps/update/tests/chrome/test_0123_check_allowNonBuiltinCert_noCertAttrsCheck.xul
rename : toolkit/mozapps/update/test/chrome/test_0131_check_invalidCertAttrs_noUpdate.xul => toolkit/mozapps/update/tests/chrome/test_0131_check_invalidCertAttrs_noUpdate.xul
rename : toolkit/mozapps/update/test/chrome/test_0132_check_invalidCertAttrs_hasUpdate.xul => toolkit/mozapps/update/tests/chrome/test_0132_check_invalidCertAttrs_hasUpdate.xul
rename : toolkit/mozapps/update/test/chrome/test_0141_notify_invalidCertAttrs_noUpdate.xul => toolkit/mozapps/update/tests/chrome/test_0141_notify_invalidCertAttrs_noUpdate.xul
rename : toolkit/mozapps/update/test/chrome/test_0142_notify_invalidCertAttrs_hasUpdate.xul => toolkit/mozapps/update/tests/chrome/test_0142_notify_invalidCertAttrs_hasUpdate.xul
rename : toolkit/mozapps/update/test/chrome/test_0151_notify_backgroundCheckError.xul => toolkit/mozapps/update/tests/chrome/test_0151_notify_backgroundCheckError.xul
rename : toolkit/mozapps/update/test/chrome/test_0161_check_unsupported.xul => toolkit/mozapps/update/tests/chrome/test_0161_check_unsupported.xul
rename : toolkit/mozapps/update/test/chrome/test_0162_notify_unsupported.xul => toolkit/mozapps/update/tests/chrome/test_0162_notify_unsupported.xul
rename : toolkit/mozapps/update/test/chrome/test_0900_deprecatedUpdateFormat_minor.xul => toolkit/mozapps/update/tests/chrome/test_0900_deprecatedUpdateFormat_minor.xul
rename : toolkit/mozapps/update/test/chrome/test_0901_deprecatedUpdateFormat_major.xul => toolkit/mozapps/update/tests/chrome/test_0901_deprecatedUpdateFormat_major.xul
rename : toolkit/mozapps/update/test/chrome/test_9999_cleanup.xul => toolkit/mozapps/update/tests/chrome/test_9999_cleanup.xul
rename : toolkit/mozapps/update/test/chrome/update.sjs => toolkit/mozapps/update/tests/chrome/update.sjs
rename : toolkit/mozapps/update/test/chrome/utils.js => toolkit/mozapps/update/tests/chrome/utils.js
rename : toolkit/mozapps/update/test/unit/data/complete.mar => toolkit/mozapps/update/tests/data/complete.mar
rename : toolkit/mozapps/update/test/unit/data/complete.png => toolkit/mozapps/update/tests/data/complete.png
rename : toolkit/mozapps/update/test/unit/data/complete_cc_log_switch_success => toolkit/mozapps/update/tests/data/complete_cc_log_switch_success
rename : toolkit/mozapps/update/test/unit/data/complete_log_success => toolkit/mozapps/update/tests/data/complete_log_success
rename : toolkit/mozapps/update/test/unit/data/complete_log_switch_success => toolkit/mozapps/update/tests/data/complete_log_switch_success
rename : toolkit/mozapps/update/test/unit/data/complete_precomplete => toolkit/mozapps/update/tests/data/complete_precomplete
rename : toolkit/mozapps/update/test/unit/data/complete_removed-files => toolkit/mozapps/update/tests/data/complete_removed-files
rename : toolkit/mozapps/update/test/unit/data/complete_update_manifest => toolkit/mozapps/update/tests/data/complete_update_manifest
rename : toolkit/mozapps/update/test/unit/data/complete_win.mar => toolkit/mozapps/update/tests/data/complete_win.mar
rename : toolkit/mozapps/update/test/unit/data/old_version_mar.mar => toolkit/mozapps/update/tests/data/old_version.mar
rename : toolkit/mozapps/update/test/unit/data/partial.mar => toolkit/mozapps/update/tests/data/partial.mar
rename : toolkit/mozapps/update/test/unit/data/partial.png => toolkit/mozapps/update/tests/data/partial.png
rename : toolkit/mozapps/update/test/unit/data/partial_in_use_win_after.exe => toolkit/mozapps/update/tests/data/partial_in_use_win_after.exe
rename : toolkit/mozapps/update/test/unit/data/partial_in_use_win_before.exe => toolkit/mozapps/update/tests/data/partial_in_use_win_before.exe
rename : toolkit/mozapps/update/test/unit/data/partial_log_failure => toolkit/mozapps/update/tests/data/partial_log_failure
rename : toolkit/mozapps/update/test/unit/data/partial_log_success => toolkit/mozapps/update/tests/data/partial_log_success
rename : toolkit/mozapps/update/test/unit/data/partial_log_switch_success => toolkit/mozapps/update/tests/data/partial_log_switch_success
rename : toolkit/mozapps/update/test/unit/data/partial_precomplete => toolkit/mozapps/update/tests/data/partial_precomplete
rename : toolkit/mozapps/update/test/unit/data/partial_removed-files => toolkit/mozapps/update/tests/data/partial_removed-files
rename : toolkit/mozapps/update/test/unit/data/partial_update_manifest => toolkit/mozapps/update/tests/data/partial_update_manifest
rename : toolkit/mozapps/update/test/unit/data/partial_win.mar => toolkit/mozapps/update/tests/data/partial_win.mar
rename : toolkit/mozapps/update/test/unit/data/simple.mar => toolkit/mozapps/update/tests/data/simple.mar
rename : toolkit/mozapps/update/test/unit/data/simple_no_pib.mar => toolkit/mozapps/update/tests/data/simple_no_pib.mar
rename : toolkit/mozapps/update/test/unit/data/wrong_product_channel_mar.mar => toolkit/mozapps/update/tests/data/wrong_product_channel.mar
rename : toolkit/mozapps/update/test/marionette/data/bad.xml => toolkit/mozapps/update/tests/marionette/data/bad.xml
rename : toolkit/mozapps/update/test/marionette/data/err.cgi => toolkit/mozapps/update/tests/marionette/data/err.cgi
rename : toolkit/mozapps/update/test/marionette/update-smoketests.ini => toolkit/mozapps/update/tests/marionette/update-smoketests.ini
rename : toolkit/mozapps/update/test/marionette/update-tests.ini => toolkit/mozapps/update/tests/marionette/update-tests.ini
rename : toolkit/mozapps/update/test/marionette/update_smoketest_ota_same_version.js => toolkit/mozapps/update/tests/marionette/update_smoketest_ota_same_version.js
rename : toolkit/mozapps/update/test/marionette/update_smoketest_ota_same_version.py => toolkit/mozapps/update/tests/marionette/update_smoketest_ota_same_version.py
rename : toolkit/mozapps/update/test/marionette/update_smoketest_ota_simple.js => toolkit/mozapps/update/tests/marionette/update_smoketest_ota_simple.js
rename : toolkit/mozapps/update/test/marionette/update_smoketest_ota_simple.py => toolkit/mozapps/update/tests/marionette/update_smoketest_ota_simple.py
rename : toolkit/mozapps/update/test/marionette/update_test_ota_simple.js => toolkit/mozapps/update/tests/marionette/update_test_ota_simple.js
rename : toolkit/mozapps/update/test/marionette/update_test_ota_simple.py => toolkit/mozapps/update/tests/marionette/update_test_ota_simple.py
rename : toolkit/mozapps/update/test/marionette/update_test_status.js => toolkit/mozapps/update/tests/marionette/update_test_status.js
rename : toolkit/mozapps/update/test/marionette/update_test_status.py => toolkit/mozapps/update/tests/marionette/update_test_status.py
rename : toolkit/mozapps/update/test/moz.build => toolkit/mozapps/update/tests/moz.build
rename : toolkit/mozapps/update/test/shared.js => toolkit/mozapps/update/tests/shared.js
rename : toolkit/mozapps/update/test/sharedUpdateXML.js => toolkit/mozapps/update/tests/sharedUpdateXML.js
rename : toolkit/mozapps/update/test/unit/test_0010_general.js => toolkit/mozapps/update/tests/unit_aus_update/canCheckForAndCanApplyUpdates.js
rename : toolkit/mozapps/update/test/unit/test_0063_manager.js => toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForDifferentChannel.js
rename : toolkit/mozapps/update/test/unit/test_0061_manager.js => toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForOlderAppVersion.js
rename : toolkit/mozapps/update/test/unit/test_0064_manager.js => toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForSameVersionAndBuildID.js
rename : toolkit/mozapps/update/test/unit/test_0072_update_dir_cleanup.js => toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingIncorrectStatus.js
rename : toolkit/mozapps/update/test/unit/test_0073_update_dir_cleanup.js => toolkit/mozapps/update/tests/unit_aus_update/cleanupPendingVersionFileIncorrectStatus.js
rename : toolkit/mozapps/update/test/unit/test_0070_update_dir_cleanup.js => toolkit/mozapps/update/tests/unit_aus_update/cleanupSuccessLogMove.js
rename : toolkit/mozapps/update/test/unit/test_0071_update_dir_cleanup.js => toolkit/mozapps/update/tests/unit_aus_update/cleanupSuccessLogsFIFO.js
rename : toolkit/mozapps/update/test/unit/test_bug595059.js => toolkit/mozapps/update/tests/unit_aus_update/downloadCompleteAfterPartialFailure.js
rename : toolkit/mozapps/update/test/unit/test_bug833708.js => toolkit/mozapps/update/tests/unit_aus_update/downloadFileTooBig_gonk.js
rename : toolkit/mozapps/update/test/unit/test_bug794211.js => toolkit/mozapps/update/tests/unit_aus_update/downloadInterruptedByOfflineRetry.js
rename : toolkit/mozapps/update/test/unit/test_0030_general.js => toolkit/mozapps/update/tests/unit_aus_update/downloadMar.js
rename : toolkit/mozapps/update/test/unit/test_0062_manager.js => toolkit/mozapps/update/tests/unit_aus_update/downloadResumeForSameAppVersion.js
rename : toolkit/mozapps/update/test/unit/head_update.js.in => toolkit/mozapps/update/tests/unit_aus_update/head_update.js
rename : toolkit/mozapps/update/test/unit/test_0020_general.js => toolkit/mozapps/update/tests/unit_aus_update/remoteUpdateXML.js
rename : toolkit/mozapps/update/test/unit/test_0081_prompt_uiAlreadyOpen.js => toolkit/mozapps/update/tests/unit_aus_update/uiOnlyAllowOneWindow.js
rename : toolkit/mozapps/update/test/unit/test_0080_prompt_silent.js => toolkit/mozapps/update/tests/unit_aus_update/uiSilentPref.js
rename : toolkit/mozapps/update/test/unit/test_0082_prompt_unsupportAlreadyNotified.js => toolkit/mozapps/update/tests/unit_aus_update/uiUnsupportedAlreadyNotified.js
rename : toolkit/mozapps/update/test/unit/test_0050_general.js => toolkit/mozapps/update/tests/unit_aus_update/updateCheckOnLoadOnErrorStatusText.js
rename : toolkit/mozapps/update/test/unit/test_0060_manager.js => toolkit/mozapps/update/tests/unit_aus_update/updateManagerXML.js
rename : toolkit/mozapps/update/test/unit/test_0300_update_root_dir_migration.js => toolkit/mozapps/update/tests/unit_aus_update/updateRootDirMigration_win.js
rename : toolkit/mozapps/update/test/unit/test_0040_general.js => toolkit/mozapps/update/tests/unit_aus_update/urlConstruction.js
rename : toolkit/mozapps/update/test/unit/xpcshell.ini => toolkit/mozapps/update/tests/unit_aus_update/xpcshell.ini
rename : toolkit/mozapps/update/test/unit/test_0203_app_launch_apply_update.js => toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateAppBinInUseStageSuccess_win.js
rename : toolkit/mozapps/update/test/unit/test_0201_app_launch_apply_update.js => toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageSuccess.js
rename : toolkit/mozapps/update/test/unit/test_0200_app_launch_apply_update.js => toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateSuccess.js
rename : toolkit/mozapps/update/test/unit/test_0162_appInUse_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marAppInUseFallbackStageFailureComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0161_appInUse_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageFailureComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0161_appInUse_xp_unix_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageSuccessComplete_unix.js
rename : toolkit/mozapps/update/test/unit/test_0160_appInUse_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marAppInUseSuccessComplete.js
rename : toolkit/mozapps/update/test/unit/test_0152_appBinReplaced_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0153_appBinPatched_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessPartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0150_appBinReplaced_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0151_appBinPatched_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessPartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0202_app_launch_apply_update_dirlocked.js => toolkit/mozapps/update/tests/unit_base_updater/marDirLockedStageFailure_win.js
rename : toolkit/mozapps/update/test/unit/test_0112_general.js => toolkit/mozapps/update/tests/unit_base_updater/marFailurePartial.js
rename : toolkit/mozapps/update/test/unit/test_0188_fileInUse_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marFileInUseFallbackStageFailureComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0189_fileInUse_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marFileInUseFallbackStageFailurePartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0184_fileInUse_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageSuccessComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0185_fileInUse_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageSuccessPartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0180_fileInUse_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0181_fileInUse_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessPartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0170_fileLocked_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailureComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0171_fileLocked_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailurePartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0174_fileLocked_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFallbackStageFailureComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0175_fileLocked_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFallbackStageFailurePartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0172_fileLocked_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailureComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0173_fileLocked_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailurePartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0190_rmrfdirFileInUse_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseFallbackStageFailureComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0191_rmrfdirFileInUse_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseFallbackStageFailurePartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0186_rmrfdirFileInUse_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageSuccessComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0187_rmrfdirFileInUse_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageSuccessPartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0182_rmrfdirFileInUse_xp_win_complete.js => toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessComplete_win.js
rename : toolkit/mozapps/update/test/unit/test_0183_rmrfdirFileInUse_xp_win_partial.js => toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessPartial_win.js
rename : toolkit/mozapps/update/test/unit/test_0115_general.js => toolkit/mozapps/update/tests/unit_base_updater/marStageFailurePartial.js
rename : toolkit/mozapps/update/test/unit/test_0113_general.js => toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessComplete.js
rename : toolkit/mozapps/update/test/unit/test_0114_general.js => toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessPartial.js
rename : toolkit/mozapps/update/test/unit/test_0110_general.js => toolkit/mozapps/update/tests/unit_base_updater/marSuccessComplete.js
rename : toolkit/mozapps/update/test/unit/test_0111_general.js => toolkit/mozapps/update/tests/unit_base_updater/marSuccessPartial.js
rename : toolkit/mozapps/update/test/unit/test_0113_versionDowngradeCheck.js => toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js
rename : toolkit/mozapps/update/test/unit/test_0114_productChannelCheck.js => toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js
rename : toolkit/mozapps/update/test/unit/xpcshell_updater.ini => toolkit/mozapps/update/tests/unit_base_updater/xpcshell.ini
rename : toolkit/mozapps/update/test_svc/unit/test_0000_bootstrap_svc.js => toolkit/mozapps/update/tests/unit_service_updater/bootstrapSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0203_app_launch_apply_update_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0201_app_launch_apply_update_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateStageSuccessSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0200_app_launch_apply_update_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateSuccessSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0162_appInUse_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marAppInUseFallbackStageFailureCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0161_appInUse_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marAppInUseStageFailureCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0160_appInUse_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marAppInUseSuccessCompleteSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0152_appBinReplaced_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0153_appBinPatched_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessPartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0150_appBinReplaced_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0151_appBinPatched_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessPartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0202_app_launch_apply_update_dirlocked_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marDirLockedStageFailureSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0112_general_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFailurePartialSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0188_fileInUse_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileInUseFallbackStageFailureCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0189_fileInUse_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileInUseFallbackStageFailurePartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0184_fileInUse_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageSuccessCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0185_fileInUse_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageSuccessPartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0180_fileInUse_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0181_fileInUse_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessPartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0170_fileLocked_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailureCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0171_fileLocked_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailurePartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0174_fileLocked_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFallbackStageFailureCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0175_fileLocked_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFallbackStageFailurePartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0172_fileLocked_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailureCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0173_fileLocked_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailurePartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0190_rmrfdirFileInUse_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseFallbackStageFailureCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0191_rmrfdirFileInUse_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseFallbackStageFailurePartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0186_rmrfdirFileInUse_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageSuccessCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0187_rmrfdirFileInUse_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageSuccessPartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0182_rmrfdirFileInUse_xp_win_complete_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessCompleteSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0183_rmrfdirFileInUse_xp_win_partial_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessPartialSvc_win.js
rename : toolkit/mozapps/update/test_svc/unit/test_0115_general_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marStageFailurePartialSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0113_general_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessCompleteSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0114_general_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessPartialSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0110_general_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marSuccessCompleteSvc.js
rename : toolkit/mozapps/update/test_svc/unit/test_0111_general_svc.js => toolkit/mozapps/update/tests/unit_service_updater/marSuccessPartialSvc.js
rename : toolkit/mozapps/update/test_svc/unit/xpcshell.ini => toolkit/mozapps/update/tests/unit_service_updater/xpcshell.ini
rename : toolkit/mozapps/update/test_timermanager/unit/test_0010_timermanager.js => toolkit/mozapps/update/tests/unit_timermanager/consumerNotifications.js
rename : toolkit/mozapps/update/test_timermanager/unit/xpcshell.ini => toolkit/mozapps/update/tests/unit_timermanager/xpcshell.ini
2013-10-25 18:37:29 -07:00

621 lines
19 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Shared code for xpcshell and mochitests-chrome */
// const Cc, Ci, and Cr are defined in netwerk/test/httpserver/httpd.js so we
// need to define unique ones.
const AUS_Cc = Components.classes;
const AUS_Ci = Components.interfaces;
const AUS_Cr = Components.results;
const AUS_Cu = Components.utils;
const AUS_Cm = Components.manager;
const PREF_APP_UPDATE_AUTO = "app.update.auto";
const PREF_APP_UPDATE_BACKGROUNDERRORS = "app.update.backgroundErrors";
const PREF_APP_UPDATE_BACKGROUNDMAXERRORS = "app.update.backgroundMaxErrors";
const PREF_APP_UPDATE_CERTS_BRANCH = "app.update.certs.";
const PREF_APP_UPDATE_CERT_CHECKATTRS = "app.update.cert.checkAttributes";
const PREF_APP_UPDATE_CERT_ERRORS = "app.update.cert.errors";
const PREF_APP_UPDATE_CERT_MAXERRORS = "app.update.cert.maxErrors";
const PREF_APP_UPDATE_CERT_REQUIREBUILTIN = "app.update.cert.requireBuiltIn";
const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
const PREF_APP_UPDATE_METRO_ENABLED = "app.update.metro.enabled";
const PREF_APP_UPDATE_IDLETIME = "app.update.idletime";
const PREF_APP_UPDATE_LOG = "app.update.log";
const PREF_APP_UPDATE_NEVER_BRANCH = "app.update.never.";
const PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED = "app.update.notifiedUnsupported";
const PREF_APP_UPDATE_PROMPTWAITTIME = "app.update.promptWaitTime";
const PREF_APP_UPDATE_SERVICE_ENABLED = "app.update.service.enabled";
const PREF_APP_UPDATE_SHOW_INSTALLED_UI = "app.update.showInstalledUI";
const PREF_APP_UPDATE_SILENT = "app.update.silent";
const PREF_APP_UPDATE_STAGING_ENABLED = "app.update.staging.enabled";
const PREF_APP_UPDATE_URL = "app.update.url";
const PREF_APP_UPDATE_URL_DETAILS = "app.update.url.details";
const PREF_APP_UPDATE_URL_OVERRIDE = "app.update.url.override";
const PREF_APP_UPDATE_SOCKET_ERRORS = "app.update.socket.maxErrors";
const PREF_APP_UPDATE_RETRY_TIMEOUT = "app.update.socket.retryTimeout";
const PREF_APP_UPDATE_CERT_INVALID_ATTR_NAME = PREF_APP_UPDATE_CERTS_BRANCH +
"1.invalidName";
const PREF_APP_PARTNER_BRANCH = "app.partner.";
const PREF_DISTRIBUTION_ID = "distribution.id";
const PREF_DISTRIBUTION_VERSION = "distribution.version";
const PREF_EXTENSIONS_UPDATE_URL = "extensions.update.url";
const PREF_EXTENSIONS_STRICT_COMPAT = "extensions.strictCompatibility";
const NS_APP_PROFILE_DIR_STARTUP = "ProfDS";
const NS_APP_USER_PROFILE_50_DIR = "ProfD";
const NS_GRE_DIR = "GreD";
const NS_XPCOM_CURRENT_PROCESS_DIR = "XCurProcD";
const XRE_EXECUTABLE_FILE = "XREExeF";
const XRE_UPDATE_ROOT_DIR = "UpdRootD";
const CRC_ERROR = 4;
const WRITE_ERROR = 7;
const DIR_UPDATED = "updated";
const FILE_BACKUP_LOG = "backup-update.log";
const FILE_LAST_LOG = "last-update.log";
const FILE_UPDATE_ACTIVE = "active-update.xml";
const FILE_UPDATE_ARCHIVE = "update.mar";
const FILE_UPDATE_LOG = "update.log";
const FILE_UPDATE_SETTINGS_INI = "update-settings.ini";
const FILE_UPDATE_SETTINGS_INI_BAK = "update-settings.ini.bak";
const FILE_UPDATE_STATUS = "update.status";
const FILE_UPDATE_VERSION = "update.version";
const FILE_UPDATER_INI = "updater.ini";
const FILE_UPDATES_DB = "updates.xml";
const UPDATE_SETTINGS_CONTENTS = "[Settings]\n" +
"ACCEPTED_MAR_CHANNEL_IDS=xpcshell-test\n"
const PR_RDWR = 0x04;
const PR_CREATE_FILE = 0x08;
const PR_APPEND = 0x10;
const PR_TRUNCATE = 0x20;
const PR_SYNC = 0x40;
const PR_EXCL = 0x80;
const DEFAULT_UPDATE_VERSION = "999999.0";
var gChannel;
#include sharedUpdateXML.js
AUS_Cu.import("resource://gre/modules/FileUtils.jsm");
AUS_Cu.import("resource://gre/modules/Services.jsm");
AUS_Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const PERMS_FILE = FileUtils.PERMS_FILE;
const PERMS_DIRECTORY = FileUtils.PERMS_DIRECTORY;
const MODE_RDONLY = FileUtils.MODE_RDONLY;
const MODE_WRONLY = FileUtils.MODE_WRONLY;
const MODE_RDWR = FileUtils.MODE_RDWR;
const MODE_CREATE = FileUtils.MODE_CREATE;
const MODE_APPEND = FileUtils.MODE_APPEND;
const MODE_TRUNCATE = FileUtils.MODE_TRUNCATE;
const URI_UPDATES_PROPERTIES = "chrome://mozapps/locale/update/updates.properties";
const gUpdateBundle = Services.strings.createBundle(URI_UPDATES_PROPERTIES);
XPCOMUtils.defineLazyGetter(this, "gAUS", function test_gAUS() {
return AUS_Cc["@mozilla.org/updates/update-service;1"].
getService(AUS_Ci.nsIApplicationUpdateService).
QueryInterface(AUS_Ci.nsITimerCallback).
QueryInterface(AUS_Ci.nsIObserver).
QueryInterface(AUS_Ci.nsIUpdateCheckListener);
});
XPCOMUtils.defineLazyServiceGetter(this, "gUpdateManager",
"@mozilla.org/updates/update-manager;1",
"nsIUpdateManager");
XPCOMUtils.defineLazyGetter(this, "gUpdateChecker", function test_gUC() {
return AUS_Cc["@mozilla.org/updates/update-checker;1"].
createInstance(AUS_Ci.nsIUpdateChecker);
});
XPCOMUtils.defineLazyGetter(this, "gUP", function test_gUP() {
return AUS_Cc["@mozilla.org/updates/update-prompt;1"].
createInstance(AUS_Ci.nsIUpdatePrompt);
});
XPCOMUtils.defineLazyGetter(this, "gDefaultPrefBranch", function test_gDPB() {
return Services.prefs.getDefaultBranch(null);
});
XPCOMUtils.defineLazyGetter(this, "gPrefRoot", function test_gPR() {
return Services.prefs.getBranch(null);
});
XPCOMUtils.defineLazyGetter(this, "gZipW", function test_gZipW() {
return AUS_Cc["@mozilla.org/zipwriter;1"].
createInstance(AUS_Ci.nsIZipWriter);
});
/* Initializes the update service stub */
function initUpdateServiceStub() {
AUS_Cc["@mozilla.org/updates/update-service-stub;1"].
createInstance(AUS_Ci.nsISupports);
}
/* Reloads the update metadata from disk */
function reloadUpdateManagerData() {
gUpdateManager.QueryInterface(AUS_Ci.nsIObserver).
observe(null, "um-reload-update-data", "");
}
/**
* Sets the app.update.channel preference.
*
* @param aChannel
* The update channel.
*/
function setUpdateChannel(aChannel) {
gChannel = aChannel;
debugDump("setting default pref " + PREF_APP_UPDATE_CHANNEL + " to " + gChannel);
gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_CHANNEL, gChannel);
gPrefRoot.addObserver(PREF_APP_UPDATE_CHANNEL, observer, false);
}
var observer = {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "nsPref:changed" && aData == PREF_APP_UPDATE_CHANNEL) {
var channel = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_CHANNEL);
if (channel != gChannel) {
debugDump("Changing channel from " + channel + " to " + gChannel);
gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_CHANNEL, gChannel);
}
}
},
QueryInterface: XPCOMUtils.generateQI([AUS_Ci.nsIObserver])
};
/**
* Sets the app.update.url.override preference.
*
* @param aURL
* The update url. If not specified 'URL_HOST + "/update.xml"' will be
* used.
*/
function setUpdateURLOverride(aURL) {
let url = aURL ? aURL : URL_HOST + "/update.xml";
debugDump("setting " + PREF_APP_UPDATE_URL_OVERRIDE + " to " + url);
Services.prefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
}
/**
* Returns either the active or regular update database XML file.
*
* @param isActiveUpdate
* If true this will return the active-update.xml otherwise it will
* return the updates.xml file.
*/
function getUpdatesXMLFile(aIsActiveUpdate) {
var file = getUpdatesRootDir();
file.append(aIsActiveUpdate ? FILE_UPDATE_ACTIVE : FILE_UPDATES_DB);
return file;
}
/**
* Writes the updates specified to either the active-update.xml or the
* updates.xml.
*
* @param aContent
* The updates represented as a string to write to the XML file.
* @param isActiveUpdate
* If true this will write to the active-update.xml otherwise it will
* write to the updates.xml file.
*/
function writeUpdatesToXMLFile(aContent, aIsActiveUpdate) {
writeFile(getUpdatesXMLFile(aIsActiveUpdate), aContent);
}
/**
* Writes the current update operation/state to a file in the patch
* directory, indicating to the patching system that operations need
* to be performed.
*
* @param aStatus
* The status value to write.
*/
function writeStatusFile(aStatus) {
var file = getUpdatesDir();
file.append("0");
file.append(FILE_UPDATE_STATUS);
aStatus += "\n";
writeFile(file, aStatus);
}
/**
* Writes the current update version to a file in the patch directory,
* indicating to the patching system the version of the update.
*
* @param aVersion
* The version value to write.
*/
function writeVersionFile(aVersion) {
var file = getUpdatesDir();
file.append("0");
file.append(FILE_UPDATE_VERSION);
aVersion += "\n";
writeFile(file, aVersion);
}
/**
* Gets the updates root directory.
*
* @return nsIFile for the updates root directory.
*/
function getUpdatesRootDir() {
try {
return Services.dirsvc.get(XRE_UPDATE_ROOT_DIR, AUS_Ci.nsIFile);
} catch (e) {
// Fall back on the current process directory
return getCurrentProcessDir();
}
}
/**
* Gets the updates directory.
*
* @return nsIFile for the updates directory.
*/
function getUpdatesDir() {
var dir = getUpdatesRootDir();
dir.append("updates");
return dir;
}
/**
* Writes text to a file. This will replace existing text if the file exists
* and create the file if it doesn't exist.
*
* @param aFile
* The file to write to. Will be created if it doesn't exist.
* @param aText
* The text to write to the file. If there is existing text it will be
* replaced.
*/
function writeFile(aFile, aText) {
var fos = AUS_Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(AUS_Ci.nsIFileOutputStream);
if (!aFile.exists())
aFile.create(AUS_Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_FILE);
fos.init(aFile, MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE, PERMS_FILE, 0);
fos.write(aText, aText.length);
fos.close();
}
/**
* Reads the current update operation/state in a file in the patch
* directory.
*
* @param aFile (optional)
* nsIFile to read the update status from. If not provided the
* application's update status file will be used.
* @return The status value.
*/
function readStatusFile(aFile) {
var file;
if (aFile) {
file = aFile.clone();
file.append(FILE_UPDATE_STATUS);
}
else {
file = getUpdatesDir();
file.append("0");
file.append(FILE_UPDATE_STATUS);
}
return readFile(file).split("\n")[0];
}
/**
* Reads text from a file and returns the string.
*
* @param aFile
* The file to read from.
* @return The string of text read from the file.
*/
function readFile(aFile) {
var fis = AUS_Cc["@mozilla.org/network/file-input-stream;1"].
createInstance(AUS_Ci.nsIFileInputStream);
if (!aFile.exists())
return null;
fis.init(aFile, MODE_RDONLY, PERMS_FILE, 0);
var sis = AUS_Cc["@mozilla.org/scriptableinputstream;1"].
createInstance(AUS_Ci.nsIScriptableInputStream);
sis.init(fis);
var text = sis.read(sis.available());
sis.close();
return text;
}
/**
* Reads the binary contents of a file and returns it as a string.
*
* @param aFile
* The file to read from.
* @return The contents of the file as a string.
*/
function readFileBytes(aFile) {
var fis = AUS_Cc["@mozilla.org/network/file-input-stream;1"].
createInstance(AUS_Ci.nsIFileInputStream);
fis.init(aFile, -1, -1, false);
var bis = AUS_Cc["@mozilla.org/binaryinputstream;1"].
createInstance(AUS_Ci.nsIBinaryInputStream);
bis.setInputStream(fis);
var data = [];
var count = fis.available();
while (count > 0) {
var bytes = bis.readByteArray(Math.min(65535, count));
data.push(String.fromCharCode.apply(null, bytes));
count -= bytes.length;
if (bytes.length == 0)
throw "Nothing read from input stream!";
}
data.join('');
fis.close();
return data.toString();
}
/* Returns human readable status text from the updates.properties bundle */
function getStatusText(aErrCode) {
return getString("check_error-" + aErrCode);
}
/* Returns a string from the updates.properties bundle */
function getString(aName) {
try {
return gUpdateBundle.GetStringFromName(aName);
}
catch (e) {
}
return null;
}
/**
* Gets the file extension for an nsIFile.
*
* @param aFile
* The file to get the file extension for.
* @return The file extension.
*/
function getFileExtension(aFile) {
return Services.io.newFileURI(aFile).QueryInterface(AUS_Ci.nsIURL).
fileExtension;
}
/**
* Removes the updates.xml file, active-update.xml file, and all files and
* sub-directories in the updates directory except for the "0" sub-directory.
* This prevents some tests from failing due to files being left behind when the
* tests are interrupted.
*/
function removeUpdateDirsAndFiles() {
var file = getUpdatesXMLFile(true);
try {
if (file.exists())
file.remove(false);
}
catch (e) {
dump("Unable to remove file\npath: " + file.path +
"\nException: " + e + "\n");
}
file = getUpdatesXMLFile(false);
try {
if (file.exists())
file.remove(false);
}
catch (e) {
dump("Unable to remove file\npath: " + file.path +
"\nException: " + e + "\n");
}
// This fails sporadically on Mac OS X so wrap it in a try catch
var updatesDir = getUpdatesDir();
try {
cleanUpdatesDir(updatesDir);
}
catch (e) {
dump("Unable to remove files / directories from directory\npath: " +
updatesDir.path + "\nException: " + e + "\n");
}
}
/**
* Removes all files and sub-directories in the updates directory except for
* the "0" sub-directory.
*
* @param aDir
* nsIFile for the directory to be deleted.
*/
function cleanUpdatesDir(aDir) {
if (!aDir.exists())
return;
var dirEntries = aDir.directoryEntries;
while (dirEntries.hasMoreElements()) {
var entry = dirEntries.getNext().QueryInterface(AUS_Ci.nsIFile);
if (entry.isDirectory()) {
if (entry.leafName == "0" && entry.parent.leafName == "updates") {
cleanUpdatesDir(entry);
entry.permissions = PERMS_DIRECTORY;
}
else {
try {
entry.remove(true);
return;
}
catch (e) {
}
cleanUpdatesDir(entry);
entry.permissions = PERMS_DIRECTORY;
try {
entry.remove(true);
}
catch (e) {
dump("cleanUpdatesDir: unable to remove directory\npath: " +
entry.path + "\nException: " + e + "\n");
throw(e);
}
}
}
else {
entry.permissions = PERMS_FILE;
try {
entry.remove(false);
}
catch (e) {
dump("cleanUpdatesDir: unable to remove file\npath: " + entry.path +
"\nException: " + e + "\n");
throw(e);
}
}
}
}
/**
* Deletes a directory and its children. First it tries nsIFile::Remove(true).
* If that fails it will fall back to recursing, setting the appropriate
* permissions, and deleting the current entry.
*
* @param aDir
* nsIFile for the directory to be deleted.
*/
function removeDirRecursive(aDir) {
if (!aDir.exists())
return;
try {
aDir.remove(true);
return;
}
catch (e) {
}
var dirEntries = aDir.directoryEntries;
while (dirEntries.hasMoreElements()) {
var entry = dirEntries.getNext().QueryInterface(AUS_Ci.nsIFile);
if (entry.isDirectory()) {
removeDirRecursive(entry);
}
else {
entry.permissions = PERMS_FILE;
try {
entry.remove(false);
}
catch (e) {
dump("removeDirRecursive: unable to remove file\npath: " + entry.path +
"\nException: " + e + "\n");
throw(e);
}
}
}
aDir.permissions = PERMS_DIRECTORY;
try {
aDir.remove(true);
}
catch (e) {
dump("removeDirRecursive: unable to remove directory\npath: " + entry.path +
"\nException: " + e + "\n");
throw(e);
}
}
/**
* Returns the directory for the currently running process. This is used to
* clean up after the tests and to locate the active-update.xml and updates.xml
* files.
*
* @return nsIFile for the current process directory.
*/
function getCurrentProcessDir() {
return Services.dirsvc.get(NS_XPCOM_CURRENT_PROCESS_DIR, AUS_Ci.nsIFile);
}
/**
* Gets the application base directory.
*
* @return nsIFile object for the application base directory.
*/
function getAppBaseDir() {
return Services.dirsvc.get(XRE_EXECUTABLE_FILE, AUS_Ci.nsIFile).parent;
}
/**
* Returns the Gecko Runtime Engine directory. This is used to locate the the
* updater binary (Windows and Linux) or updater package (Mac OS X). For
* XULRunner applications this is different than the currently running process
* directory.
*
* @return nsIFile for the Gecko Runtime Engine directory.
*/
function getGREDir() {
return Services.dirsvc.get(NS_GRE_DIR, AUS_Ci.nsIFile);
}
/**
* Get the "updated" directory inside the directory where we apply the
* background updates.
* @return The active updates directory inside the updated directory, as a
* nsIFile object.
*/
function getUpdatedDir() {
let dir = getAppBaseDir();
#ifdef XP_MACOSX
dir = dir.parent.parent; // the bundle directory
#endif
dir.append(DIR_UPDATED);
return dir;
}
/**
* Logs TEST-INFO messages.
*
* @param aText
* The text to log.
* @param aCaller (optional)
* An optional Components.stack.caller. If not specified
* Components.stack.caller will be used.
*/
function logTestInfo(aText, aCaller) {
let caller = (aCaller ? aCaller : Components.stack.caller);
let now = new Date;
let hh = now.getHours();
let mm = now.getMinutes();
let ss = now.getSeconds();
let ms = now.getMilliseconds();
let time = (hh < 10 ? "0" + hh : hh) + ":" +
(mm < 10 ? "0" + mm : mm) + ":" +
(ss < 10 ? "0" + ss : ss) + ":" +
(ms < 10 ? "00" + ms : ms < 100 ? "0" + ms : ms);
dump(time + " | TEST-INFO | " + caller.filename + " | [" + caller.name +
" : " + caller.lineNumber + "] " + aText + "\n");
}
/**
* Logs TEST-INFO messages when DEBUG_AUS_TEST evaluates to true.
*
* @param aText
* The text to log.
* @param aCaller (optional)
* An optional Components.stack.caller. If not specified
* Components.stack.caller will be used.
*/
function debugDump(aText, aCaller) {
if (DEBUG_AUS_TEST) {
let caller = aCaller ? aCaller : Components.stack.caller;
logTestInfo(aText, caller);
}
}