diff --git a/Cargo.lock b/Cargo.lock index c5269bde86a..1558aceeb1b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3988,9 +3988,9 @@ checksum = "820499e77e852162190608b4f444e7b4552619150eafc39a9e39333d9efae9e1" [[package]] name = "icu_capi" -version = "1.5.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f73a82a8307633c08ca119631cd90b006e448009da2d4466f7d76ca8fedf3b1" +checksum = "acc33c4f501b515cdb6b583b31ec009479a4c0cb4cf28dcdfcd54b29069d725e" dependencies = [ "diplomat", "diplomat-runtime", @@ -5243,7 +5243,7 @@ dependencies = [ [[package]] name = "mozjs" version = "0.14.1" -source = "git+https://github.com/servo/mozjs#75ba574b452573d8d4275331294556180bd6cea9" +source = "git+https://github.com/servo/mozjs#1410a4bafe4674ea17b1c4f0053a3e589ebce989" dependencies = [ "bindgen 0.71.1", "cc", @@ -5254,8 +5254,8 @@ dependencies = [ [[package]] name = "mozjs_sys" -version = "0.137.0-0" -source = "git+https://github.com/servo/mozjs#75ba574b452573d8d4275331294556180bd6cea9" +version = "0.137.0-1" +source = "git+https://github.com/servo/mozjs#1410a4bafe4674ea17b1c4f0053a3e589ebce989" dependencies = [ "bindgen 0.71.1", "cc", diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs index 4f5699e335c..2ad95cda739 100644 --- a/components/script/script_runtime.rs +++ b/components/script/script_runtime.rs @@ -13,6 +13,7 @@ use std::ffi::{CStr, CString}; use std::io::{Write, stdout}; use std::ops::Deref; use std::os::raw::c_void; +use std::ptr::NonNull; use std::rc::Rc; use std::sync::Mutex; use std::time::{Duration, Instant}; @@ -489,13 +490,12 @@ unsafe extern "C" fn content_security_policy_allows( allowed = match runtime_code { RuntimeCode::JS => { - let source = match sample { - sample if !sample.is_null() => &jsstr_to_string(*cx, *sample), - _ => "", - }; + let source = NonNull::new(*sample) + .map(|sample| jsstr_to_string(*cx, sample)) + .unwrap_or("".to_string()); global .get_csp_list() - .is_js_evaluation_allowed(global, source) + .is_js_evaluation_allowed(global, &source) }, RuntimeCode::WASM => global.get_csp_list().is_wasm_evaluation_allowed(global), }; diff --git a/components/script/window_named_properties.rs b/components/script/window_named_properties.rs index 3c30cede7c3..5cdb8bd6c2c 100644 --- a/components/script/window_named_properties.rs +++ b/components/script/window_named_properties.rs @@ -3,6 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use std::ptr; +use std::ptr::NonNull; use std::sync::LazyLock; use js::conversions::jsstr_to_string; @@ -115,7 +116,7 @@ unsafe extern "C" fn get_own_property_descriptor( } let s = if id.is_string() { - unsafe { jsstr_to_string(*cx, id.to_string()) } + unsafe { jsstr_to_string(*cx, NonNull::new(id.to_string()).unwrap()) } } else if id.is_int() { // If the property key is an integer index, convert it to a String too. // For indexed access on the window object, which may shadow this, see diff --git a/components/script_bindings/conversions.rs b/components/script_bindings/conversions.rs index 38ea46a8727..3bf9f077f7e 100644 --- a/components/script_bindings/conversions.rs +++ b/components/script_bindings/conversions.rs @@ -133,7 +133,7 @@ impl FromJSValConvertible for DOMString { pub unsafe fn jsstring_to_str(cx: *mut JSContext, s: ptr::NonNull) -> DOMString { let latin1 = JS_DeprecatedStringHasLatin1Chars(s.as_ptr()); DOMString::from_string(if latin1 { - latin1_to_string(cx, s.as_ptr()) + latin1_to_string(cx, s) } else { let mut length = 0; let chars = JS_GetTwoByteStringCharsAndLength(cx, ptr::null(), s.as_ptr(), &mut length);