mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
Meta: Ensure rel attribute exists before querying its value
Previously, the WPT importer would fail to import files with link tags that didn't have a `rel` attribute.
This commit is contained in:
parent
673537b26b
commit
5c032583b4
|
|
@ -67,7 +67,7 @@ class LinkedResourceFinder(HTMLParser):
|
|||
self._resources.append(attr_dict["src"])
|
||||
if tag == "link":
|
||||
attr_dict = dict(attrs)
|
||||
if attr_dict["rel"] == "stylesheet":
|
||||
if "rel" in attr_dict and attr_dict["rel"] == "stylesheet":
|
||||
self._resources.append(attr_dict["href"])
|
||||
|
||||
def handle_endtag(self, tag):
|
||||
|
|
@ -100,7 +100,7 @@ class TestTypeIdentifier(HTMLParser):
|
|||
def handle_starttag(self, tag, attrs):
|
||||
if tag == "link":
|
||||
attr_dict = dict(attrs)
|
||||
if attr_dict["rel"] == "match" or attr_dict["rel"] == "mismatch":
|
||||
if "rel" in attr_dict and (attr_dict["rel"] == "match" or attr_dict["rel"] == "mismatch"):
|
||||
if self.ref_test_link_found:
|
||||
raise RuntimeError("Ref tests with multiple match or mismatch links are not currently supported")
|
||||
self.test_type = TestType.REF
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user