mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Upgrade stylo to 2024-09-02 (#33370)
* Upgrade stylo to 2024-09-02 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Fixup for https://phabricator.services.mozilla.com/D217308 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Fixup for https://phabricator.services.mozilla.com/D217626 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Fixup for https://phabricator.services.mozilla.com/D218488 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Fixup for https://phabricator.services.mozilla.com/D219537 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Update test expectations Signed-off-by: Oriol Brufau <obrufau@igalia.com> --------- Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
261d60e456
commit
a76daaf04c
9 changed files with 68 additions and 63 deletions
|
@ -1297,16 +1297,7 @@ where
|
|||
/// returns it.
|
||||
#[allow(unsafe_code)]
|
||||
pub unsafe fn from_untrusted_node_address(candidate: UntrustedNodeAddress) -> DomRoot<Node> {
|
||||
// https://github.com/servo/servo/issues/6383
|
||||
let candidate = candidate.0 as usize;
|
||||
// let object: *mut JSObject = jsfriendapi::bindgen::JS_GetAddressableObject(runtime,
|
||||
// candidate);
|
||||
let object = candidate as *mut JSObject;
|
||||
if object.is_null() {
|
||||
panic!("Attempted to create a `Dom<Node>` from an invalid pointer!")
|
||||
}
|
||||
let boxed_node = conversions::private_from_object(object) as *const Node;
|
||||
DomRoot::from_ref(&*boxed_node)
|
||||
DomRoot::from_ref(Node::from_untrusted_node_address(candidate))
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
|
@ -2430,6 +2421,24 @@ impl Node {
|
|||
.map_or(ns!(), |elem| elem.locate_namespace(prefix)),
|
||||
}
|
||||
}
|
||||
|
||||
/// If the given untrusted node address represents a valid DOM node in the given runtime,
|
||||
/// returns it.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Callers should ensure they pass an UntrustedNodeAddress that points to a valid `JSObject`
|
||||
/// in memory that represents a `Node`.
|
||||
#[allow(unsafe_code)]
|
||||
pub unsafe fn from_untrusted_node_address(candidate: UntrustedNodeAddress) -> &'static Self {
|
||||
// https://github.com/servo/servo/issues/6383
|
||||
let candidate = candidate.0 as usize;
|
||||
let object = candidate as *mut JSObject;
|
||||
if object.is_null() {
|
||||
panic!("Attempted to create a `Node` from an invalid pointer!")
|
||||
}
|
||||
&*(conversions::private_from_object(object) as *const Self)
|
||||
}
|
||||
}
|
||||
|
||||
impl NodeMethods for Node {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue