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:
bors-servo 2014-12-20 17:51:44 -07:00
commit a773bd5c45
3 changed files with 4 additions and 4 deletions

View file

@ -1830,7 +1830,7 @@ class CGWrapMethod(CGAbstractMethod):
def __init__(self, descriptor): def __init__(self, descriptor):
assert not descriptor.interface.isCallback() assert not descriptor.interface.isCallback()
if not descriptor.isGlobal(): 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)] Argument("Box<%s>" % descriptor.concreteType, 'aObject', mutable=True)]
else: else:
args = [Argument('*mut JSContext', 'aCx'), args = [Argument('*mut JSContext', 'aCx'),

View file

@ -340,9 +340,9 @@ pub trait Reflectable {
pub fn reflect_dom_object<T: Reflectable> pub fn reflect_dom_object<T: Reflectable>
(obj: Box<T>, (obj: Box<T>,
global: GlobalRef, 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> { -> 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. /// A struct to store a reference to the reflector of a DOM object.

View file

@ -1157,7 +1157,7 @@ impl Node {
pub fn reflect_node<N: Reflectable+NodeBase> pub fn reflect_node<N: Reflectable+NodeBase>
(node: Box<N>, (node: Box<N>,
document: JSRef<Document>, 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> { -> Temporary<N> {
let window = document.window().root(); let window = document.window().root();
reflect_dom_object(node, GlobalRef::Window(*window), wrap_fn) reflect_dom_object(node, GlobalRef::Window(*window), wrap_fn)