mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Preserve sourceURL comment on style sheets
In addition to the sourceMappingURL comment, there is a second special comment, "sourceURL", that can be used to set the "display name" of a style sheet for developer tools. This name is also used as the base URL for the source-map URL resolution algorithm. sourceURL is described here: https://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/ The devtools feature bug is here: https://bugzilla.mozilla.org/show_bug.cgi?id=880831 This patch changes servo to preserve and expose this value for use in M-C.
This commit is contained in:
parent
2cbd27c83a
commit
c48226ff6f
19 changed files with 74 additions and 30 deletions
|
@ -10,7 +10,7 @@ path = "lib.rs"
|
|||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
cssparser = "0.21.0"
|
||||
cssparser = "0.21.1"
|
||||
gfx = {path = "../../../components/gfx"}
|
||||
ipc-channel = "0.8"
|
||||
style = {path = "../../../components/style"}
|
||||
|
|
|
@ -12,7 +12,7 @@ doctest = false
|
|||
[dependencies]
|
||||
byteorder = "1.0"
|
||||
app_units = "0.5"
|
||||
cssparser = "0.21.0"
|
||||
cssparser = "0.21.1"
|
||||
euclid = "0.15"
|
||||
html5ever = "0.19"
|
||||
parking_lot = "0.4"
|
||||
|
|
|
@ -249,6 +249,7 @@ fn test_parse_stylesheet() {
|
|||
})))
|
||||
], &stylesheet.shared_lock),
|
||||
source_map_url: RwLock::new(None),
|
||||
source_url: RwLock::new(None),
|
||||
},
|
||||
media: Arc::new(stylesheet.shared_lock.wrap(MediaList::empty())),
|
||||
shared_lock: stylesheet.shared_lock.clone(),
|
||||
|
@ -377,3 +378,22 @@ fn test_source_map_url() {
|
|||
assert_eq!(*url_opt, test.1);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_source_url() {
|
||||
let tests = vec![
|
||||
("", None),
|
||||
("/*# sourceURL=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,
|
||||
0);
|
||||
let url_opt = stylesheet.contents.source_url.read();
|
||||
assert_eq!(*url_opt, test.1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ doctest = false
|
|||
|
||||
[dependencies]
|
||||
atomic_refcell = "0.1"
|
||||
cssparser = "0.21.0"
|
||||
cssparser = "0.21.1"
|
||||
env_logger = "0.4"
|
||||
euclid = "0.15"
|
||||
geckoservo = {path = "../../../ports/geckolib"}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue