mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Couple more fixes to handle 'setter' properties in WebIDL
This commit is contained in:
parent
c828e83604
commit
b50cfa56a9
2 changed files with 11 additions and 11 deletions
|
@ -2091,7 +2091,7 @@ class CGDefineProxyHandler(CGAbstractMethod):
|
||||||
let traps = ProxyTraps {
|
let traps = ProxyTraps {
|
||||||
getPropertyDescriptor: Some(getPropertyDescriptor),
|
getPropertyDescriptor: Some(getPropertyDescriptor),
|
||||||
getOwnPropertyDescriptor: Some(getOwnPropertyDescriptor),
|
getOwnPropertyDescriptor: Some(getOwnPropertyDescriptor),
|
||||||
defineProperty: Some(defineProperty),
|
defineProperty: Some(defineProperty_),
|
||||||
getOwnPropertyNames: ptr::null(),
|
getOwnPropertyNames: ptr::null(),
|
||||||
delete_: Some(delete_),
|
delete_: Some(delete_),
|
||||||
enumerate: ptr::null(),
|
enumerate: ptr::null(),
|
||||||
|
@ -3506,7 +3506,8 @@ class CGProxySpecialOperation(CGPerSignatureCall):
|
||||||
# arguments[0] is the index or name of the item that we're setting.
|
# arguments[0] is the index or name of the item that we're setting.
|
||||||
argument = arguments[1]
|
argument = arguments[1]
|
||||||
template, _, declType, needsRooting = getJSToNativeConversionTemplate(
|
template, _, declType, needsRooting = getJSToNativeConversionTemplate(
|
||||||
argument.type, descriptor, treatNullAs=argument.treatNullAs)
|
argument.type, descriptor, treatNullAs=argument.treatNullAs,
|
||||||
|
exceptionCode="return false;")
|
||||||
templateValues = {
|
templateValues = {
|
||||||
"val": "(*desc).value",
|
"val": "(*desc).value",
|
||||||
}
|
}
|
||||||
|
@ -4033,7 +4034,8 @@ class CGInterfaceTrait(CGThing):
|
||||||
|
|
||||||
def members():
|
def members():
|
||||||
for m in descriptor.interface.members:
|
for m in descriptor.interface.members:
|
||||||
if m.isMethod() and not m.isStatic():
|
if m.isMethod() and not m.isStatic() \
|
||||||
|
and not m.isIdentifierLess():
|
||||||
name = CGSpecializedMethod.makeNativeName(descriptor, m)
|
name = CGSpecializedMethod.makeNativeName(descriptor, m)
|
||||||
infallible = 'infallible' in descriptor.getExtendedAttributes(m)
|
infallible = 'infallible' in descriptor.getExtendedAttributes(m)
|
||||||
for idx, (rettype, arguments) in enumerate(m.signatures()):
|
for idx, (rettype, arguments) in enumerate(m.signatures()):
|
||||||
|
@ -4064,7 +4066,10 @@ class CGInterfaceTrait(CGThing):
|
||||||
rettype, arguments = operation.signatures()[0]
|
rettype, arguments = operation.signatures()[0]
|
||||||
|
|
||||||
infallible = 'infallible' in descriptor.getExtendedAttributes(operation)
|
infallible = 'infallible' in descriptor.getExtendedAttributes(operation)
|
||||||
|
if operation.isGetter():
|
||||||
arguments = method_arguments(rettype, arguments, ("found", "&mut bool"))
|
arguments = method_arguments(rettype, arguments, ("found", "&mut bool"))
|
||||||
|
else:
|
||||||
|
arguments = method_arguments(rettype, arguments)
|
||||||
rettype = return_type(rettype, infallible)
|
rettype = return_type(rettype, infallible)
|
||||||
yield name, arguments, rettype
|
yield name, arguments, rettype
|
||||||
|
|
||||||
|
@ -4551,7 +4556,7 @@ class CGBindingRoot(CGThing):
|
||||||
'dom::bindings::error::throw_dom_exception',
|
'dom::bindings::error::throw_dom_exception',
|
||||||
'dom::bindings::error::throw_type_error',
|
'dom::bindings::error::throw_type_error',
|
||||||
'dom::bindings::proxyhandler',
|
'dom::bindings::proxyhandler',
|
||||||
'dom::bindings::proxyhandler::{_obj_toString, defineProperty}',
|
'dom::bindings::proxyhandler::{_obj_toString, defineProperty_}',
|
||||||
'dom::bindings::proxyhandler::{FillPropertyDescriptor, GetExpandoObject}',
|
'dom::bindings::proxyhandler::{FillPropertyDescriptor, GetExpandoObject}',
|
||||||
'dom::bindings::proxyhandler::{delete_, getPropertyDescriptor}',
|
'dom::bindings::proxyhandler::{delete_, getPropertyDescriptor}',
|
||||||
'dom::bindings::str::ByteString',
|
'dom::bindings::str::ByteString',
|
||||||
|
|
|
@ -48,7 +48,7 @@ pub unsafe extern fn getPropertyDescriptor(cx: *mut JSContext, proxy: *mut JSObj
|
||||||
JS_GetPropertyDescriptorById(cx, proto, id, JSRESOLVE_QUALIFIED, desc) != 0
|
JS_GetPropertyDescriptorById(cx, proto, id, JSRESOLVE_QUALIFIED, desc) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn defineProperty_(cx: *mut JSContext, proxy: *mut JSObject, id: jsid,
|
pub unsafe extern fn defineProperty_(cx: *mut JSContext, proxy: *mut JSObject, id: jsid,
|
||||||
desc: *mut JSPropertyDescriptor) -> bool {
|
desc: *mut JSPropertyDescriptor) -> bool {
|
||||||
static JSMSG_GETTER_ONLY: libc::c_uint = 160;
|
static JSMSG_GETTER_ONLY: libc::c_uint = 160;
|
||||||
|
|
||||||
|
@ -72,11 +72,6 @@ pub unsafe fn defineProperty_(cx: *mut JSContext, proxy: *mut JSObject, id: jsid
|
||||||
(*desc).setter, (*desc).attrs) != 0;
|
(*desc).setter, (*desc).attrs) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe extern fn defineProperty(cx: *mut JSContext, proxy: *mut JSObject, id: jsid,
|
|
||||||
desc: *mut JSPropertyDescriptor) -> bool {
|
|
||||||
defineProperty_(cx, proxy, id, desc)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub unsafe extern fn delete_(cx: *mut JSContext, proxy: *mut JSObject, id: jsid,
|
pub unsafe extern fn delete_(cx: *mut JSContext, proxy: *mut JSObject, id: jsid,
|
||||||
bp: *mut bool) -> bool {
|
bp: *mut bool) -> bool {
|
||||||
let expando = EnsureExpandoObject(cx, proxy);
|
let expando = EnsureExpandoObject(cx, proxy);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue