aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno.d@partner.samsung.com>2014-11-04 10:38:18 -0800
committerBruno de Oliveira Abinader <bruno.d@partner.samsung.com>2014-11-06 11:31:58 -0800
commitb50cfa56a94be66f51f9641ef63ede67c107e4a2 (patch)
treee353a83c1cf5f1e0a1712275fe85d3505b6f4691 /components/script
parentc828e8360416e61deaaf6870ebdf9ee2f0abc19b (diff)
downloadservo-b50cfa56a94be66f51f9641ef63ede67c107e4a2.tar.gz
servo-b50cfa56a94be66f51f9641ef63ede67c107e4a2.zip
Couple more fixes to handle 'setter' properties in WebIDL
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py15
-rw-r--r--components/script/dom/bindings/proxyhandler.rs7
2 files changed, 11 insertions, 11 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 6d82dedb510..72bc0f4fdb4 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -2091,7 +2091,7 @@ class CGDefineProxyHandler(CGAbstractMethod):
let traps = ProxyTraps {
getPropertyDescriptor: Some(getPropertyDescriptor),
getOwnPropertyDescriptor: Some(getOwnPropertyDescriptor),
- defineProperty: Some(defineProperty),
+ defineProperty: Some(defineProperty_),
getOwnPropertyNames: ptr::null(),
delete_: Some(delete_),
enumerate: ptr::null(),
@@ -3506,7 +3506,8 @@ class CGProxySpecialOperation(CGPerSignatureCall):
# arguments[0] is the index or name of the item that we're setting.
argument = arguments[1]
template, _, declType, needsRooting = getJSToNativeConversionTemplate(
- argument.type, descriptor, treatNullAs=argument.treatNullAs)
+ argument.type, descriptor, treatNullAs=argument.treatNullAs,
+ exceptionCode="return false;")
templateValues = {
"val": "(*desc).value",
}
@@ -4033,7 +4034,8 @@ class CGInterfaceTrait(CGThing):
def 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)
infallible = 'infallible' in descriptor.getExtendedAttributes(m)
for idx, (rettype, arguments) in enumerate(m.signatures()):
@@ -4064,7 +4066,10 @@ class CGInterfaceTrait(CGThing):
rettype, arguments = operation.signatures()[0]
infallible = 'infallible' in descriptor.getExtendedAttributes(operation)
- arguments = method_arguments(rettype, arguments, ("found", "&mut bool"))
+ if operation.isGetter():
+ arguments = method_arguments(rettype, arguments, ("found", "&mut bool"))
+ else:
+ arguments = method_arguments(rettype, arguments)
rettype = return_type(rettype, infallible)
yield name, arguments, rettype
@@ -4551,7 +4556,7 @@ class CGBindingRoot(CGThing):
'dom::bindings::error::throw_dom_exception',
'dom::bindings::error::throw_type_error',
'dom::bindings::proxyhandler',
- 'dom::bindings::proxyhandler::{_obj_toString, defineProperty}',
+ 'dom::bindings::proxyhandler::{_obj_toString, defineProperty_}',
'dom::bindings::proxyhandler::{FillPropertyDescriptor, GetExpandoObject}',
'dom::bindings::proxyhandler::{delete_, getPropertyDescriptor}',
'dom::bindings::str::ByteString',
diff --git a/components/script/dom/bindings/proxyhandler.rs b/components/script/dom/bindings/proxyhandler.rs
index 3c26206c373..3321c1f617f 100644
--- a/components/script/dom/bindings/proxyhandler.rs
+++ b/components/script/dom/bindings/proxyhandler.rs
@@ -48,7 +48,7 @@ pub unsafe extern fn getPropertyDescriptor(cx: *mut JSContext, proxy: *mut JSObj
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 {
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;
}
-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,
bp: *mut bool) -> bool {
let expando = EnsureExpandoObject(cx, proxy);