mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Stop using RootedGuard's
DerefMut impl (#36158)
* Stop using RootedGuard's DerefMut impl Signed-off-by: Greg Morenz <greg-morenz@droid.cafe> * Update mozjs version Signed-off-by: Greg Morenz <greg-morenz@droid.cafe> * `self.bytes` should not be mutably borrowed over GC pause Signed-off-by: Greg Morenz <greg-morenz@droid.cafe> --------- Signed-off-by: Greg Morenz <greg-morenz@droid.cafe>
This commit is contained in:
parent
96277c5688
commit
c728f31a10
4 changed files with 20 additions and 19 deletions
22
Cargo.lock
generated
22
Cargo.lock
generated
|
@ -520,7 +520,7 @@ dependencies = [
|
||||||
"bitflags 2.9.0",
|
"bitflags 2.9.0",
|
||||||
"cexpr",
|
"cexpr",
|
||||||
"clang-sys",
|
"clang-sys",
|
||||||
"itertools 0.13.0",
|
"itertools 0.10.5",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"regex",
|
"regex",
|
||||||
|
@ -1065,7 +1065,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
|
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2031,7 +2031,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2557,7 +2557,7 @@ dependencies = [
|
||||||
"gobject-sys",
|
"gobject-sys",
|
||||||
"libc",
|
"libc",
|
||||||
"system-deps",
|
"system-deps",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -4018,7 +4018,7 @@ checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hermit-abi 0.5.0",
|
"hermit-abi 0.5.0",
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -4312,7 +4312,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
|
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"windows-targets 0.48.5",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -4703,7 +4703,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mozjs"
|
name = "mozjs"
|
||||||
version = "0.14.1"
|
version = "0.14.1"
|
||||||
source = "git+https://github.com/servo/mozjs#39db84352d79ffa3e4fe756c8034af9def788f22"
|
source = "git+https://github.com/servo/mozjs#e4d4f9ac06162fe2647078dc4be8c270b7219807"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bindgen 0.71.1",
|
"bindgen 0.71.1",
|
||||||
"cc",
|
"cc",
|
||||||
|
@ -4715,7 +4715,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mozjs_sys"
|
name = "mozjs_sys"
|
||||||
version = "0.128.9-0"
|
version = "0.128.9-0"
|
||||||
source = "git+https://github.com/servo/mozjs#39db84352d79ffa3e4fe756c8034af9def788f22"
|
source = "git+https://github.com/servo/mozjs#e4d4f9ac06162fe2647078dc4be8c270b7219807"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bindgen 0.71.1",
|
"bindgen 0.71.1",
|
||||||
"cc",
|
"cc",
|
||||||
|
@ -6190,7 +6190,7 @@ dependencies = [
|
||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys",
|
"linux-raw-sys",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -7530,7 +7530,7 @@ dependencies = [
|
||||||
"getrandom",
|
"getrandom",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustix",
|
"rustix",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -8839,7 +8839,7 @@ version = "0.1.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -641,7 +641,7 @@ pub(crate) fn get_desired_proto(
|
||||||
// We might still have a cross-compartment wrapper for a known DOM
|
// We might still have a cross-compartment wrapper for a known DOM
|
||||||
// constructor. CheckedUnwrapStatic is fine here, because we're looking for
|
// constructor. CheckedUnwrapStatic is fine here, because we're looking for
|
||||||
// DOM constructors and those can't be cross-origin objects.
|
// DOM constructors and those can't be cross-origin objects.
|
||||||
*new_target = CheckedUnwrapStatic(*new_target);
|
new_target.set(CheckedUnwrapStatic(*new_target));
|
||||||
if !new_target.is_null() && *new_target != *original_new_target {
|
if !new_target.is_null() && *new_target != *original_new_target {
|
||||||
get_proto_id_for_new_target(new_target.handle())
|
get_proto_id_for_new_target(new_target.handle())
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -8,6 +8,7 @@ use std::mem;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::gc::MutableHandle;
|
||||||
use js::jsapi::Heap;
|
use js::jsapi::Heap;
|
||||||
use js::jsval::{JSVal, UndefinedValue};
|
use js::jsval::{JSVal, UndefinedValue};
|
||||||
use js::rust::{HandleObject as SafeHandleObject, HandleValue as SafeHandleValue};
|
use js::rust::{HandleObject as SafeHandleObject, HandleValue as SafeHandleValue};
|
||||||
|
@ -97,13 +98,13 @@ impl Callback for ReadLoopFulFillmentHandler {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Append the bytes represented by chunk to bytes.
|
// Append the bytes represented by chunk to bytes.
|
||||||
let mut bytes = self.bytes.borrow_mut();
|
self.bytes.borrow_mut().extend_from_slice(&chunk);
|
||||||
bytes.extend_from_slice(&chunk);
|
|
||||||
|
|
||||||
// Read-loop given reader, bytes, successSteps, and failureSteps.
|
// Read-loop given reader, bytes, successSteps, and failureSteps.
|
||||||
|
rooted!(in(*cx) let mut this = Some(self.clone()));
|
||||||
read_loop(
|
read_loop(
|
||||||
&global,
|
&global,
|
||||||
&mut Some(self.clone()),
|
this.handle_mut(),
|
||||||
Box::new(ReadLoopRejectionHandler {
|
Box::new(ReadLoopRejectionHandler {
|
||||||
failure_steps: self.failure_steps.clone(),
|
failure_steps: self.failure_steps.clone(),
|
||||||
}),
|
}),
|
||||||
|
@ -133,7 +134,7 @@ impl Callback for ReadLoopRejectionHandler {
|
||||||
/// <https://streams.spec.whatwg.org/#read-loop>
|
/// <https://streams.spec.whatwg.org/#read-loop>
|
||||||
fn read_loop(
|
fn read_loop(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
fulfillment_handler: &mut Option<ReadLoopFulFillmentHandler>,
|
mut fulfillment_handler: MutableHandle<Option<ReadLoopFulFillmentHandler>>,
|
||||||
rejection_handler: Box<ReadLoopRejectionHandler>,
|
rejection_handler: Box<ReadLoopRejectionHandler>,
|
||||||
realm: InRealm,
|
realm: InRealm,
|
||||||
can_gc: CanGc,
|
can_gc: CanGc,
|
||||||
|
@ -500,7 +501,7 @@ impl ReadableStreamDefaultReader {
|
||||||
let rejection_handler = Box::new(ReadLoopRejectionHandler { failure_steps });
|
let rejection_handler = Box::new(ReadLoopRejectionHandler { failure_steps });
|
||||||
read_loop(
|
read_loop(
|
||||||
global,
|
global,
|
||||||
&mut fulfillment_handler,
|
fulfillment_handler.handle_mut(),
|
||||||
rejection_handler,
|
rejection_handler,
|
||||||
realm,
|
realm,
|
||||||
can_gc,
|
can_gc,
|
||||||
|
|
|
@ -3107,12 +3107,12 @@ SetProxyReservedSlot(
|
||||||
create = """
|
create = """
|
||||||
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
|
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
|
||||||
if let Some(given) = given_proto {
|
if let Some(given) = given_proto {
|
||||||
*proto = *given;
|
proto.set(*given);
|
||||||
if get_context_realm(*cx) != get_object_realm(*given) {
|
if get_context_realm(*cx) != get_object_realm(*given) {
|
||||||
assert!(JS_WrapObject(*cx, proto.handle_mut()));
|
assert!(JS_WrapObject(*cx, proto.handle_mut()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*proto = *canonical_proto;
|
proto.set(*canonical_proto);
|
||||||
}
|
}
|
||||||
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
|
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
|
||||||
*cx,
|
*cx,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue