mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-31 22:56:04 +00:00
Meta: Detect urls to import from Worker
This commit is contained in:
parent
9a8c6ff8c3
commit
be5c52bfef
Notes:
github-actions[bot]
2025-08-18 10:28:16 +00:00
Author: https://github.com/hopafoot
Commit: be5c52bfef
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5761
Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 6 additions and 0 deletions
|
@ -71,6 +71,7 @@ class LinkedResourceFinder(HTMLParser):
|
|||
self._tag_stack_ = []
|
||||
self._match_css_url_ = re.compile(r"url\(['\"]?(?P<url>[^'\")]+)['\"]?\)")
|
||||
self._match_css_import_string_ = re.compile(r"@import\s+\"(?P<url>[^\")]+)\"")
|
||||
self._match_worker_import_path = re.compile(r"Worker\(\"(?P<url>.*)\"\)")
|
||||
self._resources = []
|
||||
|
||||
@property
|
||||
|
@ -107,6 +108,11 @@ class LinkedResourceFinder(HTMLParser):
|
|||
import_iterator = self._match_css_import_string_.finditer(data)
|
||||
for match in import_iterator:
|
||||
self._resources.append(match.group("url"))
|
||||
elif self._tag_stack_ and self._tag_stack_[-1] == "script":
|
||||
# Look for uses of Worker()
|
||||
filepath_iterator = self._match_worker_import_path.finditer(data)
|
||||
for match in filepath_iterator:
|
||||
self._resources.append(match.group("url"))
|
||||
|
||||
|
||||
class TestTypeIdentifier(HTMLParser):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue