зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1668458 - Ensure paths passed to Addons.install use os path separators only, r=marionette-reviewers,whimboo
On Windows we can end up with a mixture of / and \ which makes the install fail. Differential Revision: https://phabricator.services.mozilla.com/D92229
This commit is contained in:
Родитель
ec26b652e7
Коммит
780b07487f
|
@ -3,6 +3,7 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
import os
|
||||
|
||||
from . import errors
|
||||
|
||||
|
@ -47,6 +48,10 @@ class Addons(object):
|
|||
:raises: :exc:`AddonInstallException`
|
||||
|
||||
"""
|
||||
# On windows we can end up with a path with mixed \ and /
|
||||
# which Firefox doesn't like
|
||||
path = path.replace("/", os.path.sep)
|
||||
|
||||
body = {"path": path, "temporary": temp}
|
||||
try:
|
||||
return self._mn._send_message("Addon:Install",
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
import sys
|
||||
from unittest import skipIf
|
||||
|
||||
from marionette_driver.addons import Addons, AddonInstallException
|
||||
from marionette_harness import MarionetteTestCase
|
||||
|
@ -106,3 +108,16 @@ class TestAddons(MarionetteTestCase):
|
|||
def test_install_with_relative_path(self):
|
||||
with self.assertRaises(AddonInstallException):
|
||||
self.addons.install('webextension.xpi')
|
||||
|
||||
@skipIf(sys.platform != "win32", "Only makes sense on Windows")
|
||||
def test_install_mixed_separator_windows(self):
|
||||
# Ensure the base path has only \
|
||||
addon_path = here.replace("/", "\\")
|
||||
addon_path += "/webextension-signed.xpi"
|
||||
|
||||
addon_id = self.addons.install(addon_path, temp=True)
|
||||
self.assertIn(addon_id, self.all_addon_ids)
|
||||
self.assertEqual(addon_id, "{d3e7c1f1-2e35-4a49-89fe-9f46eb8abf0a}")
|
||||
|
||||
self.addons.uninstall(addon_id)
|
||||
self.assertNotIn(addon_id, self.all_addon_ids)
|
||||
|
|
Загрузка…
Ссылка в новой задаче