Properly set desc.obj in CodegenRust.py (fixes #11868)

This commit is contained in:
Anthony Ramine 2018-09-04 13:57:10 +02:00
parent eb6aec37e9
commit baa94702e4

View file

@ -4982,7 +4982,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod):
def __init__(self, descriptor): def __init__(self, descriptor):
args = [Argument('*mut JSContext', 'cx'), Argument('RawHandleObject', 'proxy'), args = [Argument('*mut JSContext', 'cx'), Argument('RawHandleObject', 'proxy'),
Argument('RawHandleId', 'id'), Argument('RawHandleId', 'id'),
Argument('RawMutableHandle<PropertyDescriptor>', 'desc')] Argument('RawMutableHandle<PropertyDescriptor>', 'mut desc')]
CGAbstractExternMethod.__init__(self, descriptor, "getOwnPropertyDescriptor", CGAbstractExternMethod.__init__(self, descriptor, "getOwnPropertyDescriptor",
"bool", args) "bool", args)
self.descriptor = descriptor self.descriptor = descriptor
@ -5055,7 +5055,6 @@ if %s {
else: else:
namedGet = "" namedGet = ""
# FIXME(#11868) Should assign to desc.obj, desc.get() is a copy.
return get + """\ return get + """\
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>()); rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
get_expando_object(proxy, expando.handle_mut()); get_expando_object(proxy, expando.handle_mut());
@ -5068,7 +5067,7 @@ if !expando.is_null() {
} }
if !desc.obj.is_null() { if !desc.obj.is_null() {
// Pretend the property lives on the wrapper. // Pretend the property lives on the wrapper.
desc.get().obj = proxy.get(); desc.obj = proxy.get();
return true; return true;
} }
} }