зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #1816 - Fail if JS_NewUCStringCopyN returns null in str_to_jsval (from Ms2ger:str_to_jsval-fail); r=jdm
Source-Repo: https://github.com/servo/servo Source-Revision: bc2a79599ac52ba71741edf2b50a40522e3a4bb6
This commit is contained in:
Родитель
855ade9598
Коммит
599718a52b
|
@ -211,11 +211,9 @@ pub unsafe fn str_to_jsval(cx: *JSContext, string: DOMString) -> JSVal {
|
|||
let string_utf16 = string.to_utf16();
|
||||
let jsstr = JS_NewUCStringCopyN(cx, string_utf16.as_ptr(), string_utf16.len() as libc::size_t);
|
||||
if jsstr.is_null() {
|
||||
// FIXME: is there something else we should do on failure?
|
||||
JSVAL_NULL
|
||||
} else {
|
||||
RUST_STRING_TO_JSVAL(jsstr)
|
||||
fail!("JS_NewUCStringCopyN failed");
|
||||
}
|
||||
RUST_STRING_TO_JSVAL(jsstr)
|
||||
}
|
||||
|
||||
pub unsafe fn domstring_to_jsval(cx: *JSContext, string: Option<DOMString>) -> JSVal {
|
||||
|
|
Загрузка…
Ссылка в новой задаче