Skip to content


Browse files Browse the repository at this point in the history
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
  • Loading branch information
bholley authored and emilio committed Apr 28, 2018
1 parent bc1126e commit c06e3dc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ports/geckolib/
Expand Up @@ -1130,16 +1130,15 @@ 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,
quirks_mode: nsCompatibility,
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,
Expand Down

0 comments on commit c06e3dc

Please sign in to comment.