mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-23 10:50:49 +00: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
Notes:
github-actions[bot]
2024-12-23 11:54:30 +00:00
Author: https://github.com/tcl3
Commit: 5c032583b4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3018
1 changed files with 2 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue