diff --git a/components/style/gecko_bindings/nsstring_vendor/src/lib.rs b/components/style/gecko_bindings/nsstring_vendor/src/lib.rs index 7080e57cbd0..af0ba1d1918 100644 --- a/components/style/gecko_bindings/nsstring_vendor/src/lib.rs +++ b/components/style/gecko_bindings/nsstring_vendor/src/lib.rs @@ -144,6 +144,7 @@ use std::ptr; use std::mem; use std::fmt; use std::cmp; +use std::str; use std::u32; ////////////////////////////////// @@ -569,6 +570,10 @@ impl nsACString { Gecko_AppendUTF16toCString(self as *mut _, other as *const _); } } + + pub unsafe fn as_str_unchecked(&self) -> &str { + str::from_utf8_unchecked(self) + } } impl<'a> From<&'a str> for nsCString<'a> {