From 26fe0c90387265f9d946ca036c4b4c2aca50c063 Mon Sep 17 00:00:00 2001 From: Dmitry Mityugov Date: Wed, 4 May 2022 05:05:04 +0300 Subject: [PATCH] Fix Attributerrror for Chromium browser (#33912) self.last_url_used is compared with None but is never initialized to None in class Chromium. This means that if the comparison is performed before self.last_url_used is set to a valid value, wpt will crash with message AttributeError: 'Chromium' object has no attribute 'last_url_used' This problem can be reproduced with this command line: ./wpt run --binary /usr/bin/chromium chromium An alternate way to fix this would be to add a constructor to Chromium class that initializes self.last_url_used, but this constructor will also have to declare and pass parameters to Chromium's base class(es), that will look more complicated compared to this patch. --- tools/wpt/browser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/wpt/browser.py b/tools/wpt/browser.py index c4b263c3145f83..5490c9a7e6ea15 100644 --- a/tools/wpt/browser.py +++ b/tools/wpt/browser.py @@ -789,7 +789,7 @@ def _get_webdriver_url(self, version): # Make sure we use the same revision in an invocation. # If we have a url that was last used successfully during this run, # that url takes priority over trying to form another. - if self.last_url_used is not None: + if hasattr(self, "last_url_used") and self.last_url_used is not None: return f"{self.last_url_used}{filename}" return f"{self._get_chromium_download_url(version)}{filename}"