mirror of
https://github.com/servo/servo.git
synced 2025-08-16 02:45:36 +01:00
Auto merge of #18512 - tromey:preserve-style-sheet-source-url, r=SimonSapin
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. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18512) <!-- Reviewable:end -->
This commit is contained in:
commit
7cc0af37cf
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