Skip to content

Commit

Permalink
Fix Attributerrror for Chromium browser (web-platform-tests#33912)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dmityugov authored May 4, 2022
1 parent f704c49 commit 26fe0c9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/wpt/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit 26fe0c9

Please sign in to comment.