diff --git a/py/selenium/webdriver/firefox/firefox_profile.py b/py/selenium/webdriver/firefox/firefox_profile.py index 0deb2587a3acc..6b1dce381b387 100644 --- a/py/selenium/webdriver/firefox/firefox_profile.py +++ b/py/selenium/webdriver/firefox/firefox_profile.py @@ -276,17 +276,11 @@ def parse_manifest_json(content): try: if zipfile.is_zipfile(addon_path): - # Bug 944361 - We cannot use 'with' together with zipFile because - # it will cause an exception thrown in Python 2.6. - # TODO: use with statement when Python 2.x is no longer supported - try: - compressed_file = zipfile.ZipFile(addon_path, "r") + with zipfile.ZipFile(addon_path, "r") as compressed_file: if "manifest.json" in compressed_file.namelist(): return parse_manifest_json(compressed_file.read("manifest.json")) manifest = compressed_file.read("install.rdf") - finally: - compressed_file.close() elif os.path.isdir(addon_path): manifest_json_filename = os.path.join(addon_path, "manifest.json") if os.path.exists(manifest_json_filename):