Bug 1384137 - use mozprofile instead of marionette to install webextensions r=ahal
authorTarek Ziadé <tarek@mozilla.com>
Thu, 27 Jul 2017 13:42:37 +0200
changeset 371971 807acedaf25de607e78ef55453cef1a5e25e183c
parent 371970 3a7473bd9db5f2741725b436cbcb976b7922a937
child 371972 0e84cc65962564c9037779a5eab7ca32d23f8192
push id32263
push userkwierso@gmail.com
push dateMon, 31 Jul 2017 23:43:31 +0000
treeherdermozilla-central@8b19670d12fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1384137
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1384137 - use mozprofile instead of marionette to install webextensions r=ahal MozReview-Commit-ID: 7lfrn6Nv79o
testing/talos/requirements.txt
testing/talos/talos/ffsetup.py
--- a/testing/talos/requirements.txt
+++ b/testing/talos/requirements.txt
@@ -2,10 +2,9 @@ mozlog>=3.1
 mozcrash>=0.15
 mozfile>=1.2
 mozhttpd>=0.7
 mozinfo>=0.8
 mozprocess>=0.22
 mozversion>=1.3
 mozprofile>=0.25
 psutil>=3.1.1
-marionette_driver>=1.4.0
 simplejson>=2.1.1
--- a/testing/talos/talos/ffsetup.py
+++ b/testing/talos/talos/ffsetup.py
@@ -9,18 +9,16 @@ Set up a browser environment before runn
 import os
 import tempfile
 import mozfile
 import mozinfo
 import mozrunner
 
 from mozprocess import ProcessHandlerMixin
 from mozprofile.profile import Profile
-from marionette_driver.marionette import Marionette
-from marionette_driver.addons import Addons
 from mozlog import get_proxy_logger
 
 from talos import utils
 from talos.utils import TalosError
 from talos.gecko_profile import GeckoProfile
 
 
 LOG = get_proxy_logger()
@@ -100,85 +98,59 @@ class FFSetup(object):
             extensions = [os.path.dirname(i) for i in extensions]
 
         profile = Profile.clone(
             os.path.normpath(self.test_config['profile_path']),
             self.profile_dir,
             restore=False)
 
         profile.set_preferences(preferences)
+
+        # installing addons
         profile.addon_manager.install_addons(extensions)
 
+        # installing webextensions
+        webextensions = self.test_config.get('webextensions', None)
+        if isinstance(webextensions, basestring):
+            webextensions = [webextensions]
+
+        if webextensions is not None:
+            for webext in webextensions:
+                filename = utils.interpolate(webext)
+                if mozinfo.os == 'win':
+                    filename = filename.replace('/', '\\')
+                if not filename.endswith('.xpi'):
+                    continue
+                if not os.path.exists(filename):
+                    continue
+
+                profile.addon_manager.install_from_path(filename)
+
     def _run_profile(self):
         runner_cls = mozrunner.runners.get(
             mozinfo.info.get(
                 'appname',
                 'firefox'),
             mozrunner.Runner)
-
-        if self.test_config.get('webextensions', None):
-            # bug 1272255 - marionette doesn't work with MOZ_DISABLE_NONLOCAL_CONNECTIONS
-            self.env['MOZ_DISABLE_NONLOCAL_CONNECTIONS'] = '0'
-
-            args = [self.browser_config["extra_args"], "-marionette"]
-            runner = runner_cls(profile=self.profile_dir,
-                                binary=self.browser_config["browser_path"],
-                                cmdargs=args,
-                                env=self.env,
-                                process_class=ProcessHandlerMixin,
-                                process_args={})
-
-            runner.start(outputTimeout=30)
-            proc = runner.process_handler
-            LOG.process_start(proc.pid, "%s %s" % (self.browser_config["browser_path"],
-                                                   ' '.join(args)))
-
-            try:
-                client = Marionette(host='localhost', port=2828)
-                client.start_session()
-                addons = Addons(client)
-            except Exception, e:
-                print e
-                raise TalosError("Failed to initialize Talos profile with Marionette")
+        args = [self.browser_config["extra_args"], self.browser_config["init_url"]]
+        runner = runner_cls(profile=self.profile_dir,
+                            binary=self.browser_config["browser_path"],
+                            cmdargs=args,
+                            env=self.env,
+                            process_class=ProcessHandlerMixin,
+                            process_args={})
 
-            extensions = self.test_config.get('webextensions', None)
-            if isinstance(extensions, str):
-                extensions = [self.test_config.get('webextensions', None)]
-            for ext in extensions:
-                filename = utils.interpolate(ext)
-                if mozinfo.os == 'win':
-                    filename = filename.replace('/', '\\')
-
-                if not filename.endswith('.xpi'):
-                    continue
-                if not os.path.exists(filename):
-                    continue
-
-                addons.install(filename)
-
-            # browse to init_url which will close the browser
-            client.navigate(self.browser_config["init_url"])
-            client.close()
-        else:
-            args = [self.browser_config["extra_args"], self.browser_config["init_url"]]
-            runner = runner_cls(profile=self.profile_dir,
-                                binary=self.browser_config["browser_path"],
-                                cmdargs=args,
-                                env=self.env,
-                                process_class=ProcessHandlerMixin,
-                                process_args={})
-
-            runner.start(outputTimeout=30)
-            proc = runner.process_handler
-            LOG.process_start(proc.pid, "%s %s" % (self.browser_config["browser_path"],
-                                                   ' '.join(args)))
+        runner.start(outputTimeout=30)
+        proc = runner.process_handler
+        LOG.process_start(proc.pid, "%s %s" % (self.browser_config["browser_path"],
+                                               ' '.join(args)))
 
         try:
             exit_code = proc.wait()
-        except Exception, e:
+        except Exception:
             proc.kill()
             raise TalosError("Browser Failed to close properly during warmup")
 
         LOG.process_exit(proc.pid, exit_code)
 
     def _init_gecko_profile(self):
         upload_dir = os.getenv('MOZ_UPLOAD_DIR')
         if self.test_config.get('gecko_profile') and not upload_dir: