mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Add unrooted_must_root lint for usages of JS<T> in let/for bindings
This commit is contained in:
parent
12dc54d238
commit
bded5c3703
11 changed files with 55 additions and 15 deletions
|
@ -668,6 +668,7 @@ pub extern fn outerize_global(_cx: *mut JSContext, obj: JSHandleObject) -> *mut
|
|||
}
|
||||
|
||||
/// Returns the global object of the realm that the given JS object was created in.
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn global_object_for_js_object(obj: *mut JSObject) -> GlobalField {
|
||||
unsafe {
|
||||
let global = GetGlobalForObjectCrossCompartment(obj);
|
||||
|
@ -689,6 +690,7 @@ pub fn global_object_for_js_object(obj: *mut JSObject) -> GlobalField {
|
|||
|
||||
/// Get the `JSContext` for the `JSRuntime` associated with the thread
|
||||
/// this object is on.
|
||||
#[allow(unrooted_must_root)]
|
||||
fn cx_for_dom_reflector(obj: *mut JSObject) -> *mut JSContext {
|
||||
let global = global_object_for_js_object(obj);
|
||||
let global = global.root();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue