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:
Tom Tromey 2017-08-11 14:40:20 -06:00
parent fbabcaf614
commit 7224a5617f
7 changed files with 61 additions and 17 deletions

View file

@ -1056,6 +1056,18 @@ pub extern "C" fn Servo_StyleSheet_GetOrigin(
}
}
#[no_mangle]
pub extern "C" fn Servo_StyleSheet_GetSourceMapURL(
sheet: RawServoStyleSheetContentsBorrowed,
result: *mut nsAString
) {
let contents = StylesheetContents::as_arc(&sheet);
let url_opt = contents.source_map_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
{