style: Pass a bonafide nsACString to Servo.

This will allow the Rust code hold a copy-free strong reference to the string
past callstack unwind.

Bug: 1454460
Reviewed-by: bz
MozReview-Commit-ID: HCop9h2abZU
This commit is contained in:
Bobby Holley 2018-02-13 17:23:59 -08:00 committed by Emilio Cobos Álvarez
parent bc1126ee8c
commit c06e3dcd58
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -1130,8 +1130,7 @@ pub extern "C" fn Servo_StyleSheet_FromUTF8Bytes(
loader: *mut Loader,
stylesheet: *mut ServoStyleSheet,
load_data: *mut SheetLoadData,
data: *const u8,
data_len: usize,
bytes: *const nsACString,
mode: SheetParsingMode,
extra_data: *mut URLExtraData,
line_number_offset: u32,
@ -1139,7 +1138,7 @@ pub extern "C" fn Servo_StyleSheet_FromUTF8Bytes(
reusable_sheets: *mut LoaderReusableStyleSheets,
) -> RawServoStyleSheetContentsStrong {
let global_style_data = &*GLOBAL_STYLE_DATA;
let input = unsafe { ::std::str::from_utf8_unchecked(::std::slice::from_raw_parts(data, data_len)) };
let input: &str = unsafe { (*bytes).as_str_unchecked() };
let origin = match mode {
SheetParsingMode::eAuthorSheetFeatures => Origin::Author,