зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1389488 - Check that add-on file exists before forwarding request to AddonManager r=whimboo
MozReview-Commit-ID: 6b6QS9y6vPj --HG-- extra : rebase_source : c4d2174ba11ddcc5076152982b761bb02ee94d65
This commit is contained in:
Родитель
bc43ebe7e0
Коммит
dbb37eec2c
|
@ -91,6 +91,10 @@ addon.install = async function(path, temporary = false) {
|
|||
let file = new FileUtils.File(path);
|
||||
let addon;
|
||||
|
||||
if (!file.exists()) {
|
||||
throw new UnknownError(`Could not find add-on at '${path}'`);
|
||||
}
|
||||
|
||||
try {
|
||||
if (temporary) {
|
||||
addon = await AddonManager.installTemporaryAddon(file);
|
||||
|
|
|
@ -91,3 +91,9 @@ class TestAddons(MarionetteTestCase):
|
|||
|
||||
with self.assertRaises(AddonInstallException):
|
||||
self.addons.install(addon_path)
|
||||
|
||||
def test_install_nonexistent_addon(self):
|
||||
addon_path = os.path.join(here, "does-not-exist.xpi")
|
||||
|
||||
with self.assertRaisesRegexp(AddonInstallException, "Could not find add-on at"):
|
||||
self.addons.install(addon_path)
|
||||
|
|
Загрузка…
Ссылка в новой задаче