Skip to content
Permalink
Browse files

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 c06e3dcd589d5188be70cda9a6c9ef495dc8c78b
Showing with 2 additions and 3 deletions.
  1. +2 −3 ports/geckolib/glue.rs
@@ -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,

0 comments on commit c06e3dc

Please sign in to comment.
You can’t perform that action at this time.