script: complete resolve_module_specifier (#37552)

Implement whole spec of `resolve_module_specifier`. Servo can now
support script element with import map type!

Testing: `tests/wpt/tests/import-map`
Fixes: #37316 #36394

---------

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
This commit is contained in:
Ngo Iok Ui (Wu Yu Wei) 2025-06-21 15:17:27 +09:00 committed by GitHub
parent d7269c0f3b
commit 927573de97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 376 additions and 281 deletions

View file

@ -105,6 +105,17 @@ impl ServoUrl {
scheme == "about" || scheme == "blob" || scheme == "data"
}
/// <https://url.spec.whatwg.org/#special-scheme>
pub fn is_special_scheme(&self) -> bool {
let scheme = self.scheme();
scheme == "ftp" ||
scheme == "file" ||
scheme == "http" ||
scheme == "https" ||
scheme == "ws" ||
scheme == "wss"
}
pub fn as_str(&self) -> &str {
self.0.as_str()
}