mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
auto merge of #4454 : amwatson/servo/global_update, r=jdm
Changed fn_wrap argument in reflect_dom_object() and reflect_node() to pass GlobalRef by value rather than by reference. Fixes #4165
This commit is contained in:
commit
a773bd5c45
3 changed files with 4 additions and 4 deletions
|
@ -1830,7 +1830,7 @@ class CGWrapMethod(CGAbstractMethod):
|
|||
def __init__(self, descriptor):
|
||||
assert not descriptor.interface.isCallback()
|
||||
if not descriptor.isGlobal():
|
||||
args = [Argument('*mut JSContext', 'aCx'), Argument('&GlobalRef', 'aScope'),
|
||||
args = [Argument('*mut JSContext', 'aCx'), Argument('GlobalRef', 'aScope'),
|
||||
Argument("Box<%s>" % descriptor.concreteType, 'aObject', mutable=True)]
|
||||
else:
|
||||
args = [Argument('*mut JSContext', 'aCx'),
|
||||
|
|
|
@ -340,9 +340,9 @@ pub trait Reflectable {
|
|||
pub fn reflect_dom_object<T: Reflectable>
|
||||
(obj: Box<T>,
|
||||
global: GlobalRef,
|
||||
wrap_fn: extern "Rust" fn(*mut JSContext, &GlobalRef, Box<T>) -> Temporary<T>)
|
||||
wrap_fn: extern "Rust" fn(*mut JSContext, GlobalRef, Box<T>) -> Temporary<T>)
|
||||
-> Temporary<T> {
|
||||
wrap_fn(global.get_cx(), &global, obj)
|
||||
wrap_fn(global.get_cx(), global, obj)
|
||||
}
|
||||
|
||||
/// A struct to store a reference to the reflector of a DOM object.
|
||||
|
|
|
@ -1157,7 +1157,7 @@ impl Node {
|
|||
pub fn reflect_node<N: Reflectable+NodeBase>
|
||||
(node: Box<N>,
|
||||
document: JSRef<Document>,
|
||||
wrap_fn: extern "Rust" fn(*mut JSContext, &GlobalRef, Box<N>) -> Temporary<N>)
|
||||
wrap_fn: extern "Rust" fn(*mut JSContext, GlobalRef, Box<N>) -> Temporary<N>)
|
||||
-> Temporary<N> {
|
||||
let window = document.window().root();
|
||||
reflect_dom_object(node, GlobalRef::Window(*window), wrap_fn)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue