Index: third_party/WebKit/LayoutTests/external/wpt/check_stability.py |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/check_stability.py b/third_party/WebKit/LayoutTests/external/wpt/check_stability.py |
index a411f338b04b51b732ff298b466e0f0295ad9971..dc0bfd66da66c1b77a6ba8c119d65e18851c2b75 100644 |
--- a/third_party/WebKit/LayoutTests/external/wpt/check_stability.py |
+++ b/third_party/WebKit/LayoutTests/external/wpt/check_stability.py |
@@ -137,8 +137,8 @@ def replace_streams(capacity, warning_msg): |
count[0] += length |
if count[0] > capacity: |
- sys.stdout.disable() |
- sys.stderr.disable() |
+ wrapped_stdout.disable() |
+ wrapped_stderr.disable() |
handle.write(msg[0:capacity - count[0]]) |
handle.flush() |
stderr.write("\n%s\n" % warning_msg) |
@@ -146,8 +146,10 @@ def replace_streams(capacity, warning_msg): |
return True |
- sys.stdout = FilteredIO(sys.stdout, on_write) |
- sys.stderr = FilteredIO(sys.stderr, on_write) |
+ # Store local references to the replaced streams to guard against the case |
+ # where other code replace the global references. |
+ sys.stdout = wrapped_stdout = FilteredIO(sys.stdout, on_write) |
+ sys.stderr = wrapped_stderr = FilteredIO(sys.stderr, on_write) |
class Browser(object): |
@@ -183,7 +185,11 @@ class Firefox(Browser): |
def install(self): |
"""Install Firefox.""" |
call("pip", "install", "-r", os.path.join(wptrunner_root, "requirements_firefox.txt")) |
- resp = get("https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/firefox-53.0a1.en-US.linux-x86_64.tar.bz2") |
+ index = get("https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/") |
+ latest = re.compile("<a[^>]*>(firefox-\d+\.\d(?:\w\d)?.en-US.linux-x86_64\.tar\.bz2)</a>") |
+ filename = latest.search(index.text).group(1) |
+ resp = get("https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/%s" % |
+ filename) |
untar(resp.raw) |
if not os.path.exists("profiles"): |