mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
script_bindings: Remove jsstring_to_str
(#38527)
This PR removes `jsstring_to_str`, which is replaced with
`jsstr_to_string`, and updates `mozjs` to
6f3dcb99a7
.
Given that servo now always replaces unpaired surrogate since
https://github.com/servo/servo/pull/35381, the internal conversion
function `jsstring_to_str` is functionally the same as `jsstr_to_string`
from `mozjs`. This PR removes `jsstring_to_str` and replaces with
`jsstr_to_string` with conversions to `DOMString` where necessary.
Testing: Passes all unit test. No regression was found in WPT test (see
try run: https://github.com/minghuaw/servo/actions/runs/16821156583)
---------
Signed-off-by: minghuaw <wuminghua7@huawei.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Co-authored-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
a3e0a34802
commit
ad18638534
10 changed files with 49 additions and 81 deletions
|
@ -13,7 +13,6 @@ 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};
|
||||
|
@ -490,9 +489,8 @@ unsafe extern "C" fn content_security_policy_allows(
|
|||
|
||||
allowed = match runtime_code {
|
||||
RuntimeCode::JS => {
|
||||
let source = NonNull::new(*sample)
|
||||
.map(|sample| jsstr_to_string(*cx, sample))
|
||||
.unwrap_or("".to_string());
|
||||
let source = std::ptr::NonNull::new(*sample)
|
||||
.map_or_else(String::new, |jsstr| jsstr_to_string(*cx, jsstr));
|
||||
global
|
||||
.get_csp_list()
|
||||
.is_js_evaluation_allowed(global, &source)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue