mirror of
https://github.com/servo/servo.git
synced 2025-08-17 03:15:34 +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
|
@ -15,7 +15,7 @@ gecko_debug = ["style/gecko_debug"]
|
|||
|
||||
[dependencies]
|
||||
atomic_refcell = "0.1"
|
||||
cssparser = "0.21.0"
|
||||
cssparser = "0.21.1"
|
||||
env_logger = {version = "0.4", default-features = false} # disable `regex` to reduce code size
|
||||
libc = "0.2"
|
||||
log = {version = "0.3.5", features = ["release_max_level_info"]}
|
||||
|
|
|
@ -1124,6 +1124,18 @@ pub extern "C" fn Servo_StyleSheet_GetSourceMapURL(
|
|||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_StyleSheet_GetSourceURL(
|
||||
sheet: RawServoStyleSheetContentsBorrowed,
|
||||
result: *mut nsAString
|
||||
) {
|
||||
let contents = StylesheetContents::as_arc(&sheet);
|
||||
let url_opt = contents.source_url.read();
|
||||
if let Some(ref url) = *url_opt {
|
||||
write!(unsafe { &mut *result }, "{}", url).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
fn read_locked_arc<T, R, F>(raw: &<Locked<T> as HasFFI>::FFIType, func: F) -> R
|
||||
where Locked<T>: HasArcFFI, F: FnOnce(&T) -> R
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue