mirror of
https://github.com/servo/servo.git
synced 2025-08-08 15:05:35 +01:00
Expose the source map URL on a style sheet
This changes Servo to track the source map URL of a style sheet. This parallels a change going in to Gecko: https://bugzilla.mozilla.org/show_bug.cgi?id=1388855
This commit is contained in:
parent
fbabcaf614
commit
7224a5617f
7 changed files with 61 additions and 17 deletions
|
@ -241,6 +241,7 @@ fn test_parse_stylesheet() {
|
|||
},
|
||||
})))
|
||||
], &stylesheet.shared_lock),
|
||||
source_map_url: RwLock::new(None),
|
||||
},
|
||||
media: Arc::new(stylesheet.shared_lock.wrap(MediaList::empty())),
|
||||
shared_lock: stylesheet.shared_lock.clone(),
|
||||
|
@ -350,3 +351,22 @@ fn test_no_report_unrecognized_vendor_properties() {
|
|||
error.message);
|
||||
assert!(errors.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_source_map_url() {
|
||||
let tests = vec![
|
||||
("", None),
|
||||
("/*# sourceMappingURL=something */", Some("something".to_string())),
|
||||
];
|
||||
|
||||
for test in tests {
|
||||
let url = ServoUrl::parse("about::test").unwrap();
|
||||
let lock = SharedRwLock::new();
|
||||
let media = Arc::new(lock.wrap(MediaList::empty()));
|
||||
let stylesheet = Stylesheet::from_str(test.0, url.clone(), Origin::UserAgent, media, lock,
|
||||
None, &CSSErrorReporterTest, QuirksMode::NoQuirks,
|
||||
0u64);
|
||||
let url_opt = stylesheet.contents.source_map_url.read();
|
||||
assert_eq!(*url_opt, test.1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue