diff --git a/tools/wptrunner/wptrunner/browsers/fennec.py b/tools/wptrunner/wptrunner/browsers/fennec.py index 35f6f5dbd01977..15f6c0088e2646 100644 --- a/tools/wptrunner/wptrunner/browsers/fennec.py +++ b/tools/wptrunner/wptrunner/browsers/fennec.py @@ -227,8 +227,9 @@ def stop(self, force=False): if self.runner is not None: try: if self.runner.device.connected: - self.runner.device.device.remove_forwards( - "tcp:{}".format(self.marionette_port)) + if len(self.runner.device.device.list_forwards()) > 0: + self.runner.device.device.remove_forwards( + "tcp:{}".format(self.marionette_port)) except Exception: traceback.print_exception(*sys.exc_info()) # We assume that stopping the runner prompts the