Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd DOMQuad element #8882
Add DOMQuad element #8882
Conversation
|
|
|
||
| [Constructor(optional DOMPointInit p1, optional DOMPointInit p2, | ||
| optional DOMPointInit p3, optional DOMPointInit p4), | ||
| Exposed=Window,Exposed=Worker] |
This comment has been minimized.
This comment has been minimized.
nox
Dec 10, 2015
Member
This is not the exposed set you are looking for, it should be "Exposed=(Window,Worker)".
|
-S-awaiting-review +S-blocked-on-external This needs the tests in #8915. Reviewed 2 of 4 files at r1, 2 of 2 files at r2. components/script/dom/dompointreadonly.rs, line 48 [r2] (raw file): components/script/dom/domquad.rs, line 47 [r2] (raw file): components/script/dom/domquad.rs, line 54 [r2] (raw file): components/script/dom/domquad.rs, line 59 [r2] (raw file): components/script/dom/domquad.rs, line 115 [r2] (raw file): components/script/dom/domquad.rs, line 121 [r2] (raw file): Comments from the review on Reviewable.io |
|
|
Reviewed 1 of 2 files at r3, 2 of 2 files at r5. components/script/dom/dompointreadonly.rs, line 48 [r5] (raw file): components/script/dom/domquad.rs, line 58 [r5] (raw file): components/script/dom/domquad.rs, line 158 [r5] (raw file): Comments from the review on Reviewable.io |
Fix invalid dictionary inheritance Needed by #8882. cc @nox <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8966) <!-- Reviewable:end -->
|
+S-awaiting-answer Review status: 0 of 6 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed. components/script/dom/webidls/DOMQuad.webidl, line 24 [r6] (raw file): Comments from the review on Reviewable.io |
|
The current issue is the following: ./mach build --dev
Compiling script v0.0.1 (file:///home/ggomez/rust/servo/components/servo)
Compiling servo v0.0.1 (file:///home/ggomez/rust/servo/components/servo)
/home/ggomez/rust/servo/target/debug/build/script-9efc763c2889ea11/out/Bindings/DOMQuadBinding.rs:121:42: 121:47 error: mismatched types:
expected `core::result::Result<dom::bindings::codegen::Bindings::DOMQuadBinding::DOMQuadInit, ()>`,
found `bool`
(expected enum `core::result::Result`,
found bool) [E0308]
/home/ggomez/rust/servo/target/debug/build/script-9efc763c2889ea11/out/Bindings/DOMQuadBinding.rs:121 Err(_) => return false,
^~~~~
/home/ggomez/rust/servo/components/script/dom/bindings/mod.rs:158:9: 158:64 note: in this expansion of include!
/home/ggomez/rust/servo/target/debug/build/script-9efc763c2889ea11/out/Bindings/DOMQuadBinding.rs:121:42: 121:47 help: run `rustc --explain E0308` to see a detailed explanation
/home/ggomez/rust/servo/target/debug/build/script-9efc763c2889ea11/out/Bindings/DOMQuadBinding.rs:135:42: 135:47 error: mismatched types:
expected `core::result::Result<dom::bindings::codegen::Bindings::DOMQuadBinding::DOMQuadInit, ()>`,
found `bool`
(expected enum `core::result::Result`,
found bool) [E0308]
/home/ggomez/rust/servo/target/debug/build/script-9efc763c2889ea11/out/Bindings/DOMQuadBinding.rs:135 Err(_) => return false,
^~~~~
/home/ggomez/rust/servo/components/script/dom/bindings/mod.rs:158:9: 158:64 note: in this expansion of include!
/home/ggomez/rust/servo/target/debug/build/script-9efc763c2889ea11/out/Bindings/DOMQuadBinding.rs:135:42: 135:47 help: run `rustc --explain E0308` to see a detailed explanation
/home/ggomez/rust/servo/target/debug/build/script-9efc763c2889ea11/out/Bindings/DOMQuadBinding.rs:149:42: 149:47 error: mismatched types:
expected `core::result::Result<dom::bindings::codegen::Bindings::DOMQuadBinding::DOMQuadInit, ()>`,
found `bool`
(expected enum `core::result::Result`,
found bool) [E0308]
/home/ggomez/rust/servo/target/debug/build/script-9efc763c2889ea11/out/Bindings/DOMQuadBinding.rs:149 Err(_) => return false,
^~~~~
/home/ggomez/rust/servo/components/script/dom/bindings/mod.rs:158:9: 158:64 note: in this expansion of include!
/home/ggomez/rust/servo/target/debug/build/script-9efc763c2889ea11/out/Bindings/DOMQuadBinding.rs:149:42: 149:47 help: run `rustc --explain E0308` to see a detailed explanation
/home/ggomez/rust/servo/target/debug/build/script-9efc763c2889ea11/out/Bindings/DOMQuadBinding.rs:163:42: 163:47 error: mismatched types:
expected `core::result::Result<dom::bindings::codegen::Bindings::DOMQuadBinding::DOMQuadInit, ()>`,
found `bool`
(expected enum `core::result::Result`,
found bool) [E0308]
/home/ggomez/rust/servo/target/debug/build/script-9efc763c2889ea11/out/Bindings/DOMQuadBinding.rs:163 Err(_) => return false,
^~~~~
/home/ggomez/rust/servo/components/script/dom/bindings/mod.rs:158:9: 158:64 note: in this expansion of include!
/home/ggomez/rust/servo/target/debug/build/script-9efc763c2889ea11/out/Bindings/DOMQuadBinding.rs:163:42: 163:47 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to 4 previous errors
Could not compile `script`.
To learn more, run the command again with --verbose.
Build completed in 15.94sAnd here is the DOMQuadBindings.rs file: /* THIS FILE IS AUTOGENERATED - DO NOT EDIT */
#![allow(non_camel_case_types,non_upper_case_globals,unused_imports,unused_variables,unused_assignments)]
use dom::bindings;
use dom::bindings::callback::wrap_call_this_object;
use dom::bindings::callback::{CallSetup,ExceptionHandling};
use dom::bindings::callback::{CallbackContainer,CallbackInterface,CallbackFunction};
use dom::bindings::codegen::Bindings::*;
use dom::bindings::codegen::{PrototypeList, RegisterBindings, UnionTypes};
use dom::bindings::conversions::{ConversionBehavior, DOM_OBJECT_SLOT, IDLInterface};
use dom::bindings::conversions::{FromJSValConvertible, StringificationBehavior};
use dom::bindings::conversions::{ToJSValConvertible, jsid_to_str, native_from_handlevalue};
use dom::bindings::conversions::{native_from_object, private_from_object, root_from_object};
use dom::bindings::conversions::{root_from_handleobject, root_from_handlevalue};
use dom::bindings::error::Error::JSFailed;
use dom::bindings::error::throw_dom_exception;
use dom::bindings::error::{Fallible, Error, ErrorResult};
use dom::bindings::global::{GlobalRef, global_root_from_object, global_root_from_reflector};
use dom::bindings::js::{JS, Root, RootedReference};
use dom::bindings::js::{OptionalRootedReference};
use dom::bindings::num::Finite;
use dom::bindings::proxyhandler;
use dom::bindings::proxyhandler::{ensure_expando_object, fill_property_descriptor};
use dom::bindings::proxyhandler::{get_expando_object, get_property_descriptor};
use dom::bindings::reflector::{Reflectable};
use dom::bindings::str::ByteString;
use dom::bindings::str::USVString;
use dom::bindings::trace::RootedVec;
use dom::bindings::trace::{JSTraceable, RootedTraceable};
use dom::bindings::utils::ConstantVal::{IntVal, UintVal};
use dom::bindings::utils::{ConstantSpec, DOMClass, DOMJSClass};
use dom::bindings::utils::{DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, JSCLASS_DOM_GLOBAL};
use dom::bindings::utils::{NativeProperties, NativePropertyHooks, NonNullJSNative};
use dom::bindings::utils::{create_dom_global, do_create_interface_objects, finalize_global};
use dom::bindings::utils::{find_enum_string_index, generic_getter};
use dom::bindings::utils::{generic_lenient_getter, generic_lenient_setter};
use dom::bindings::utils::{generic_method, generic_setter, get_array_index_from_id};
use dom::bindings::utils::{get_dictionary_property, get_property_on_prototype};
use dom::bindings::utils::{get_proto_or_iface_array, has_property_on_prototype};
use dom::bindings::utils::{is_platform_object, set_dictionary_property};
use dom::bindings::utils::{throwing_constructor, trace_global};
use dom::bindings::weakref::{DOM_WEAK_SLOT, WeakBox, WeakReferenceable};
use dom::types::DOMPoint;
use dom::types::DOMQuad;
use dom::types::DOMRectReadOnly;
use js;
use js::error::throw_type_error;
use js::glue::AppendToAutoIdVector;
use js::glue::{CallJitMethodOp, CallJitGetterOp, CallJitSetterOp, CreateProxyHandler};
use js::glue::{GetProxyPrivate, NewProxyObject, ProxyTraps};
use js::glue::{RUST_FUNCTION_VALUE_TO_JITINFO};
use js::glue::{RUST_JS_NumberValue, RUST_JSID_IS_STRING, int_to_jsid};
use js::jsapi::{AliasSet, ArgType, AutoIdVector, CallArgs, FreeOp};
use js::jsapi::{GetGlobalForObjectCrossCompartment , GetPropertyKeys, Handle};
use js::jsapi::{HandleId, HandleObject, HandleValue, HandleValueArray};
use js::jsapi::{INTERNED_STRING_TO_JSID, IsCallable, JS_CallFunctionValue};
use js::jsapi::{JSContext, JSClass, JSFreeOp, JSFunctionSpec, JSJitGetterCallArgs};
use js::jsapi::{JSJitInfo, JSJitMethodCallArgs, JSJitSetterCallArgs, JSNative};
use js::jsapi::{JSObject, JSNativeWrapper, JSPropertyDescriptor, JSPropertySpec};
use js::jsapi::{JSString, JSTracer, JSType, JSTypedMethodJitInfo, JSValueType};
use js::jsapi::{JS_ComputeThis, JS_CopyPropertiesFrom, JS_ForwardGetPropertyTo};
use js::jsapi::{JS_GetClass, JS_GetGlobalForObject, JS_GetObjectPrototype};
use js::jsapi::{JS_GetProperty, JS_GetPropertyById, JS_GetPropertyDescriptorById};
use js::jsapi::{JS_GetReservedSlot, JS_HasProperty, JS_HasPropertyById};
use js::jsapi::{JS_InitializePropertiesFromCompatibleNativeObject, JS_InternString};
use js::jsapi::{JS_IsExceptionPending, JS_NewObject, JS_NewObjectWithGivenProto};
use js::jsapi::{JS_NewObjectWithoutMetadata, JS_SetProperty, JS_SetPrototype};
use js::jsapi::{JS_SetReservedSlot, JS_WrapValue, JSAutoCompartment, JSAutoRequest};
use js::jsapi::{MutableHandleValue, RootedId, RootedObject, RootedString};
use js::jsapi::{ObjectOpResult, OpType, MutableHandle, MutableHandleObject};
use js::jsapi::{RootedValue, SymbolCode, jsid};
use js::jsval::JSVal;
use js::jsval::{NullValue, UndefinedValue};
use js::jsval::{ObjectValue, ObjectOrNullValue, PrivateValue};
use js::rust::{GCMethods, define_methods, define_properties};
use js::{JSCLASS_GLOBAL_SLOT_COUNT, JSCLASS_IMPLEMENTS_BARRIERS};
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL, JSCLASS_RESERVED_SLOTS_MASK};
use js::{JSCLASS_RESERVED_SLOTS_SHIFT, JSITER_HIDDEN, JSITER_OWNONLY};
use js::{JSITER_SYMBOLS, JSPROP_ENUMERATE, JSPROP_PERMANENT, JSPROP_READONLY};
use js::{JSPROP_SHARED, JS_CALLEE};
use libc;
use mem::heap_size_of_raw_self_and_children;
use std::borrow::ToOwned;
use std::cmp;
use std::default::Default;
use std::ffi::CString;
use std::mem;
use std::num;
use std::ptr;
use std::rc;
use std::rc::Rc;
use std::str;
use util::str::DOMString;
pub struct DOMQuadInit {
pub p1: DOMPointBinding::DOMPointInit,
pub p2: DOMPointBinding::DOMPointInit,
pub p3: DOMPointBinding::DOMPointInit,
pub p4: DOMPointBinding::DOMPointInit,
}
impl DOMQuadInit {
pub unsafe fn empty(cx: *mut JSContext) -> DOMQuadInit {
DOMQuadInit::new(cx, HandleValue::null()).unwrap()
}
pub unsafe fn new(cx: *mut JSContext, val: HandleValue) -> Result<DOMQuadInit, ()> {
let object = if val.get().is_null_or_undefined() {
RootedObject::new(cx, ptr::null_mut())
} else if val.get().is_object() {
RootedObject::new(cx, val.get().to_object())
} else {
throw_type_error(cx, "Value not an object.");
return Err(());
};
Ok(DOMQuadInit {
p1: {
let mut rval = RootedValue::new(cx, UndefinedValue());
match try!(get_dictionary_property(cx, object.handle(), "p1", rval.handle_mut())) {
true => {
match DOMPointBinding::DOMPointInit::new(cx, rval.handle()) {
Ok(dictionary) => dictionary,
Err(_) => return false,
}
},
false => {
DOMPointBinding::DOMPointInit::empty(cx)
},
}
},
p2: {
let mut rval = RootedValue::new(cx, UndefinedValue());
match try!(get_dictionary_property(cx, object.handle(), "p2", rval.handle_mut())) {
true => {
match DOMPointBinding::DOMPointInit::new(cx, rval.handle()) {
Ok(dictionary) => dictionary,
Err(_) => return false,
}
},
false => {
DOMPointBinding::DOMPointInit::empty(cx)
},
}
},
p3: {
let mut rval = RootedValue::new(cx, UndefinedValue());
match try!(get_dictionary_property(cx, object.handle(), "p3", rval.handle_mut())) {
true => {
match DOMPointBinding::DOMPointInit::new(cx, rval.handle()) {
Ok(dictionary) => dictionary,
Err(_) => return false,
}
},
false => {
DOMPointBinding::DOMPointInit::empty(cx)
},
}
},
p4: {
let mut rval = RootedValue::new(cx, UndefinedValue());
match try!(get_dictionary_property(cx, object.handle(), "p4", rval.handle_mut())) {
true => {
match DOMPointBinding::DOMPointInit::new(cx, rval.handle()) {
Ok(dictionary) => dictionary,
Err(_) => return false,
}
},
false => {
DOMPointBinding::DOMPointInit::empty(cx)
},
}
},
})
}
}
impl ToJSValConvertible for DOMQuadInit {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
let obj = RootedObject::new(cx, JS_NewObject(cx, ptr::null()));
let mut p1 = RootedValue::new(cx, UndefinedValue());
self.p1.to_jsval(cx, p1.handle_mut());
set_dictionary_property(cx, obj.handle(), "p1", p1.handle()).unwrap();
let mut p2 = RootedValue::new(cx, UndefinedValue());
self.p2.to_jsval(cx, p2.handle_mut());
set_dictionary_property(cx, obj.handle(), "p2", p2.handle()).unwrap();
let mut p3 = RootedValue::new(cx, UndefinedValue());
self.p3.to_jsval(cx, p3.handle_mut());
set_dictionary_property(cx, obj.handle(), "p3", p3.handle()).unwrap();
let mut p4 = RootedValue::new(cx, UndefinedValue());
self.p4.to_jsval(cx, p4.handle_mut());
set_dictionary_property(cx, obj.handle(), "p4", p4.handle()).unwrap();
rval.set(ObjectOrNullValue(obj.ptr))
}
}
pub fn GetProtoObject(cx: *mut JSContext, global: HandleObject, receiver: HandleObject, rval: MutableHandleObject) {
unsafe {
/* Get the interface prototype object for this class. This will create the
object as needed. */
/* global and receiver are usually the same, but they can be different
too. For example a sandbox often has an xray wrapper for a window as the
prototype of the sandbox's global. In that case receiver is the xray
wrapper and global is the sandbox's global.
*/
assert!(((*JS_GetClass(global.get())).flags & JSCLASS_DOM_GLOBAL) != 0);
/* Check to see whether the interface objects are already installed */
let proto_or_iface_array = get_proto_or_iface_array(global.get());
rval.set((*proto_or_iface_array)[PrototypeList::ID::DOMQuad as usize]);
if !rval.get().is_null() {
return;
}
CreateInterfaceObjects(cx, global, receiver, rval);
assert!(!rval.get().is_null());
(*proto_or_iface_array)[PrototypeList::ID::DOMQuad as usize] = rval.get();
if <*mut JSObject>::needs_post_barrier(rval.get()) {
<*mut JSObject>::post_barrier((*proto_or_iface_array).as_mut_ptr().offset(PrototypeList::ID::DOMQuad as isize))
}
}
}
unsafe extern fn fromRect(cx: *mut JSContext, argc: libc::c_uint, vp: *mut JSVal) -> bool {
let global = global_root_from_object(JS_CALLEE(cx, vp).to_object());
let args = CallArgs::from_vp(vp, argc);
let arg0: DOMRectReadOnlyBinding::DOMRectInit = if args.get(0).is_undefined() {
DOMRectReadOnlyBinding::DOMRectInit::empty(cx)
} else {
match DOMRectReadOnlyBinding::DOMRectInit::new(cx, args.get(0)) {
Ok(dictionary) => dictionary,
Err(_) => return false,
}
};
let result: Root<DOMQuad> = DOMQuad::FromRect(global.r(), &arg0);
(result).to_jsval(cx, args.rval());
return true;
}
unsafe extern fn fromQuad(cx: *mut JSContext, argc: libc::c_uint, vp: *mut JSVal) -> bool {
let global = global_root_from_object(JS_CALLEE(cx, vp).to_object());
let args = CallArgs::from_vp(vp, argc);
let arg0: DOMQuadBinding::DOMQuadInit = if args.get(0).is_undefined() {
DOMQuadBinding::DOMQuadInit::empty(cx)
} else {
match DOMQuadBinding::DOMQuadInit::new(cx, args.get(0)) {
Ok(dictionary) => dictionary,
Err(_) => return false,
}
};
let result: Root<DOMQuad> = DOMQuad::FromQuad(global.r(), &arg0);
(result).to_jsval(cx, args.rval());
return true;
}
unsafe extern fn get_p1(cx: *mut JSContext, _obj: HandleObject, this: *const DOMQuad, args: JSJitGetterCallArgs) -> bool {
let this = &*this;
let result: Root<DOMPoint> = this.P1();
(result).to_jsval(cx, args.rval());
return true;
}
const p1_getterinfo: JSJitInfo = JSJitInfo {
call: get_p1 as *const ::libc::c_void,
protoID: PrototypeList::ID::DOMQuad as u16,
depth: 0,
_bitfield_1:
JSJitInfo::new_bitfield_1(
OpType::Getter as u8,
AliasSet::AliasNone as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
true,
false,
false,
false,
0 as u16,
)
};
unsafe extern fn get_p2(cx: *mut JSContext, _obj: HandleObject, this: *const DOMQuad, args: JSJitGetterCallArgs) -> bool {
let this = &*this;
let result: Root<DOMPoint> = this.P2();
(result).to_jsval(cx, args.rval());
return true;
}
const p2_getterinfo: JSJitInfo = JSJitInfo {
call: get_p2 as *const ::libc::c_void,
protoID: PrototypeList::ID::DOMQuad as u16,
depth: 0,
_bitfield_1:
JSJitInfo::new_bitfield_1(
OpType::Getter as u8,
AliasSet::AliasNone as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
true,
false,
false,
false,
0 as u16,
)
};
unsafe extern fn get_p3(cx: *mut JSContext, _obj: HandleObject, this: *const DOMQuad, args: JSJitGetterCallArgs) -> bool {
let this = &*this;
let result: Root<DOMPoint> = this.P3();
(result).to_jsval(cx, args.rval());
return true;
}
const p3_getterinfo: JSJitInfo = JSJitInfo {
call: get_p3 as *const ::libc::c_void,
protoID: PrototypeList::ID::DOMQuad as u16,
depth: 0,
_bitfield_1:
JSJitInfo::new_bitfield_1(
OpType::Getter as u8,
AliasSet::AliasNone as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
true,
false,
false,
false,
0 as u16,
)
};
unsafe extern fn get_p4(cx: *mut JSContext, _obj: HandleObject, this: *const DOMQuad, args: JSJitGetterCallArgs) -> bool {
let this = &*this;
let result: Root<DOMPoint> = this.P4();
(result).to_jsval(cx, args.rval());
return true;
}
const p4_getterinfo: JSJitInfo = JSJitInfo {
call: get_p4 as *const ::libc::c_void,
protoID: PrototypeList::ID::DOMQuad as u16,
depth: 0,
_bitfield_1:
JSJitInfo::new_bitfield_1(
OpType::Getter as u8,
AliasSet::AliasNone as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
true,
false,
false,
false,
0 as u16,
)
};
unsafe extern fn get_bounds(cx: *mut JSContext, _obj: HandleObject, this: *const DOMQuad, args: JSJitGetterCallArgs) -> bool {
let this = &*this;
let result: Root<DOMRectReadOnly> = this.Bounds();
(result).to_jsval(cx, args.rval());
return true;
}
const bounds_getterinfo: JSJitInfo = JSJitInfo {
call: get_bounds as *const ::libc::c_void,
protoID: PrototypeList::ID::DOMQuad as u16,
depth: 0,
_bitfield_1:
JSJitInfo::new_bitfield_1(
OpType::Getter as u8,
AliasSet::AliasNone as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
true,
false,
false,
false,
0 as u16,
)
};
unsafe extern fn _finalize(_fop: *mut FreeOp, obj: *mut JSObject) {
let this = native_from_object::<DOMQuad>(obj).unwrap();
if !this.is_null() {
// The pointer can be null if the object is the unforgeable holder of that interface.
let _ = Box::from_raw(this as *mut DOMQuad);
}
debug!("DOMQuad finalize: {:p}", this);
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
let this = native_from_object::<DOMQuad>(obj).unwrap();
if this.is_null() { return; } // GC during obj creation
(*this).trace(trc);
}
unsafe extern fn _constructor(cx: *mut JSContext, argc: u32, vp: *mut JSVal) -> bool {
let global = global_root_from_object(JS_CALLEE(cx, vp).to_object());
let args = CallArgs::from_vp(vp, argc);
let arg0: DOMPointBinding::DOMPointInit = if args.get(0).is_undefined() {
DOMPointBinding::DOMPointInit::empty(cx)
} else {
match DOMPointBinding::DOMPointInit::new(cx, args.get(0)) {
Ok(dictionary) => dictionary,
Err(_) => return false,
}
};
let arg1: DOMPointBinding::DOMPointInit = if args.get(1).is_undefined() {
DOMPointBinding::DOMPointInit::empty(cx)
} else {
match DOMPointBinding::DOMPointInit::new(cx, args.get(1)) {
Ok(dictionary) => dictionary,
Err(_) => return false,
}
};
let arg2: DOMPointBinding::DOMPointInit = if args.get(2).is_undefined() {
DOMPointBinding::DOMPointInit::empty(cx)
} else {
match DOMPointBinding::DOMPointInit::new(cx, args.get(2)) {
Ok(dictionary) => dictionary,
Err(_) => return false,
}
};
let arg3: DOMPointBinding::DOMPointInit = if args.get(3).is_undefined() {
DOMPointBinding::DOMPointInit::empty(cx)
} else {
match DOMPointBinding::DOMPointInit::new(cx, args.get(3)) {
Ok(dictionary) => dictionary,
Err(_) => return false,
}
};
let result: Result<Root<DOMQuad>, Error> = DOMQuad::Constructor(global.r(), &arg0, &arg1, &arg2, &arg3);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, global.r(), e);
return false;
},
};
(result).to_jsval(cx, args.rval());
return true;
}
static PrototypeClass: JSClass = JSClass {
name: b"DOMQuadPrototype\0" as *const u8 as *const libc::c_char,
flags:
// JSCLASS_HAS_RESERVED_SLOTS(0)
(0 & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT,
addProperty: None,
delProperty: None,
getProperty: None,
setProperty: None,
enumerate: None,
resolve: None,
convert: None,
finalize: None,
call: None,
hasInstance: None,
construct: None,
trace: None,
reserved: [0 as *mut libc::c_void; 25]
};
const sStaticMethods: &'static [JSFunctionSpec] = &[
JSFunctionSpec {
name: b"fromRect\0" as *const u8 as *const libc::c_char,
call: JSNativeWrapper { op: Some(fromRect), info: 0 as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: b"fromQuad\0" as *const u8 as *const libc::c_char,
call: JSNativeWrapper { op: Some(fromQuad), info: 0 as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: 0 as *const libc::c_char,
call: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
nargs: 0,
flags: 0,
selfHostedName: 0 as *const libc::c_char
}
];
const sAttributes: &'static [JSPropertySpec] = &[
JSPropertySpec {
name: b"p1\0" as *const u8 as *const libc::c_char,
flags: ((JSPROP_ENUMERATE | JSPROP_SHARED) & 0xFF) as u8,
getter: JSNativeWrapper { op: Some(generic_getter), info: &p1_getterinfo },
setter: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo }
},
JSPropertySpec {
name: b"p2\0" as *const u8 as *const libc::c_char,
flags: ((JSPROP_ENUMERATE | JSPROP_SHARED) & 0xFF) as u8,
getter: JSNativeWrapper { op: Some(generic_getter), info: &p2_getterinfo },
setter: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo }
},
JSPropertySpec {
name: b"p3\0" as *const u8 as *const libc::c_char,
flags: ((JSPROP_ENUMERATE | JSPROP_SHARED) & 0xFF) as u8,
getter: JSNativeWrapper { op: Some(generic_getter), info: &p3_getterinfo },
setter: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo }
},
JSPropertySpec {
name: b"p4\0" as *const u8 as *const libc::c_char,
flags: ((JSPROP_ENUMERATE | JSPROP_SHARED) & 0xFF) as u8,
getter: JSNativeWrapper { op: Some(generic_getter), info: &p4_getterinfo },
setter: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo }
},
JSPropertySpec {
name: b"bounds\0" as *const u8 as *const libc::c_char,
flags: ((JSPROP_ENUMERATE | JSPROP_SHARED) & 0xFF) as u8,
getter: JSNativeWrapper { op: Some(generic_getter), info: &bounds_getterinfo },
setter: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo }
},
JSPropertySpec {
name: 0 as *const libc::c_char,
flags: 0,
getter: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
setter: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo }
}
];
static sNativeProperties: NativeProperties = NativeProperties {
static_methods: Some(sStaticMethods),
static_attrs: None,
methods: None,
unforgeable_methods: None,
attrs: Some(sAttributes),
unforgeable_attrs: None,
consts: None,
};
pub static sNativePropertyHooks: NativePropertyHooks = NativePropertyHooks {
native_properties: &sNativeProperties,
proto_hooks: None,
};
fn CreateInterfaceObjects(cx: *mut JSContext, global: HandleObject, receiver: HandleObject, rval: MutableHandleObject) {
unsafe {
let mut parent_proto = RootedObject::new(cx, ptr::null_mut());
parent_proto.ptr = JS_GetObjectPrototype(cx, global);
assert!(!parent_proto.ptr.is_null());
let named_constructors: [(NonNullJSNative, &'static str, u32); 0] = [
];
do_create_interface_objects(cx, receiver, parent_proto.handle(),
Some(&PrototypeClass), Some((_constructor as NonNullJSNative, "DOMQuad", 0)),
&named_constructors,
&sNativeProperties, rval);
}
}
pub mod DOMQuadConstants {
} // mod DOMQuadConstants
pub fn DefineDOMInterface(cx: *mut JSContext, global: HandleObject) {
assert!(!global.get().is_null());
let mut proto = RootedObject::new(cx, ptr::null_mut());
GetProtoObject(cx, global, global, proto.handle_mut());
assert!(!proto.ptr.is_null());
}
static Class: DOMJSClass = DOMJSClass {
base: js::jsapi::Class {
name: b"DOMQuad\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_IMPLEMENTS_BARRIERS | 0 |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) <<
JSCLASS_RESERVED_SLOTS_SHIFT), //JSCLASS_HAS_RESERVED_SLOTS(1),
addProperty: None,
delProperty: None,
getProperty: None,
setProperty: None,
enumerate: None,
resolve: None,
convert: None,
finalize: Some(_finalize),
call: None,
hasInstance: None,
construct: None,
trace: Some(_trace),
spec: js::jsapi::ClassSpec {
createConstructor: None,
createPrototype: None,
constructorFunctions: 0 as *const js::jsapi::JSFunctionSpec,
constructorProperties: 0 as *const js::jsapi::JSPropertySpec,
prototypeFunctions: 0 as *const js::jsapi::JSFunctionSpec,
prototypeProperties: 0 as *const js::jsapi::JSPropertySpec,
finishInit: None,
flags: 0,
},
ext: js::jsapi::ClassExtension {
outerObject: None,
innerObject: None,
isWrappedNative: false,
weakmapKeyDelegateOp: None,
objectMovedOp: None,
},
ops: js::jsapi::ObjectOps {
lookupProperty: None,
defineProperty: None,
hasProperty: None,
getProperty: None,
setProperty: None,
getOwnPropertyDescriptor: None,
deleteProperty: None,
watch: None,
unwatch: None,
getElements: None,
enumerate: None,
thisObject: None,
},
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::DOMQuad, PrototypeList::ID::Count, PrototypeList::ID::Count, PrototypeList::ID::Count, PrototypeList::ID::Count, PrototypeList::ID::Count ],
native_hooks: &sNativePropertyHooks,
type_id: ::dom::bindings::codegen::InheritTypes::TopTypeId::Alone,
heap_size_of: heap_size_of_raw_self_and_children::<DOMQuad> as unsafe fn(_) -> _,
}
};
pub fn Wrap(cx: *mut JSContext, scope: GlobalRef, object: Box<DOMQuad>) -> Root<DOMQuad> {
unsafe {
let _ar = JSAutoRequest::new(cx);
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*JS_GetClass(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let mut proto = RootedObject::new(cx, ptr::null_mut());
let _ac = JSAutoCompartment::new(cx, scope.get());
GetProtoObject(cx, scope, scope, proto.handle_mut());
assert!(!proto.ptr.is_null());
let raw = Box::into_raw(object);
let _rt = RootedTraceable::new(&*raw);
let obj = RootedObject::new(cx, JS_NewObjectWithGivenProto(
cx, &Class.base as *const js::jsapi::Class as *const JSClass, proto.handle()));
assert!(!obj.ptr.is_null());
JS_SetReservedSlot(obj.ptr, DOM_OBJECT_SLOT,
PrivateValue(raw as *const libc::c_void));
(*raw).init_reflector(obj.ptr);
Root::from_ref(&*raw)
}
}
impl IDLInterface for DOMQuad {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
class as *const _ == &Class.dom_class as *const _
}
}
pub trait DOMQuadMethods {
fn P1(&self) -> Root<DOMPoint>;
fn P2(&self) -> Root<DOMPoint>;
fn P3(&self) -> Root<DOMPoint>;
fn P4(&self) -> Root<DOMPoint>;
fn Bounds(&self) -> Root<DOMRectReadOnly>;
} |
|
The error: /home/ggomez/rust/servo/target/debug/build/script-9efc763c2889ea11/out/Bindings/BlobBinding.rs:378:33: 378:34 error: mismatched types:
expected `bool`,
found `core::result::Result<dom::bindings::codegen::Bindings::BlobBinding::BlobPropertyBag, ()>`
(expected bool,
found enum `core::result::Result`) [E0308]
/home/ggomez/rust/servo/target/debug/build/script-9efc763c2889ea11/out/Bindings/BlobBinding.rs:378 e => return e,
^and the file: /* THIS FILE IS AUTOGENERATED - DO NOT EDIT */
#![allow(non_camel_case_types,non_upper_case_globals,unused_imports,unused_variables,unused_assignments)]
use dom::bindings;
use dom::bindings::callback::wrap_call_this_object;
use dom::bindings::callback::{CallSetup,ExceptionHandling};
use dom::bindings::callback::{CallbackContainer,CallbackInterface,CallbackFunction};
use dom::bindings::codegen::Bindings::*;
use dom::bindings::codegen::{PrototypeList, RegisterBindings, UnionTypes};
use dom::bindings::conversions::{ConversionBehavior, DOM_OBJECT_SLOT, IDLInterface};
use dom::bindings::conversions::{FromJSValConvertible, StringificationBehavior};
use dom::bindings::conversions::{ToJSValConvertible, jsid_to_str, native_from_handlevalue};
use dom::bindings::conversions::{native_from_object, private_from_object, root_from_object};
use dom::bindings::conversions::{root_from_handleobject, root_from_handlevalue};
use dom::bindings::error::Error::JSFailed;
use dom::bindings::error::throw_dom_exception;
use dom::bindings::error::{Fallible, Error, ErrorResult};
use dom::bindings::global::{GlobalRef, global_root_from_object, global_root_from_reflector};
use dom::bindings::js::{JS, Root, RootedReference};
use dom::bindings::js::{OptionalRootedReference};
use dom::bindings::num::Finite;
use dom::bindings::proxyhandler;
use dom::bindings::proxyhandler::{ensure_expando_object, fill_property_descriptor};
use dom::bindings::proxyhandler::{get_expando_object, get_property_descriptor};
use dom::bindings::reflector::{Reflectable};
use dom::bindings::str::ByteString;
use dom::bindings::str::USVString;
use dom::bindings::trace::RootedVec;
use dom::bindings::trace::{JSTraceable, RootedTraceable};
use dom::bindings::utils::ConstantVal::{IntVal, UintVal};
use dom::bindings::utils::{ConstantSpec, DOMClass, DOMJSClass};
use dom::bindings::utils::{DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, JSCLASS_DOM_GLOBAL};
use dom::bindings::utils::{NativeProperties, NativePropertyHooks, NonNullJSNative};
use dom::bindings::utils::{create_dom_global, do_create_interface_objects, finalize_global};
use dom::bindings::utils::{find_enum_string_index, generic_getter};
use dom::bindings::utils::{generic_lenient_getter, generic_lenient_setter};
use dom::bindings::utils::{generic_method, generic_setter, get_array_index_from_id};
use dom::bindings::utils::{get_dictionary_property, get_property_on_prototype};
use dom::bindings::utils::{get_proto_or_iface_array, has_property_on_prototype};
use dom::bindings::utils::{is_platform_object, set_dictionary_property};
use dom::bindings::utils::{throwing_constructor, trace_global};
use dom::bindings::weakref::{DOM_WEAK_SLOT, WeakBox, WeakReferenceable};
use dom::types::Blob;
use js;
use js::error::throw_type_error;
use js::glue::AppendToAutoIdVector;
use js::glue::{CallJitMethodOp, CallJitGetterOp, CallJitSetterOp, CreateProxyHandler};
use js::glue::{GetProxyPrivate, NewProxyObject, ProxyTraps};
use js::glue::{RUST_FUNCTION_VALUE_TO_JITINFO};
use js::glue::{RUST_JS_NumberValue, RUST_JSID_IS_STRING, int_to_jsid};
use js::jsapi::{AliasSet, ArgType, AutoIdVector, CallArgs, FreeOp};
use js::jsapi::{GetGlobalForObjectCrossCompartment , GetPropertyKeys, Handle};
use js::jsapi::{HandleId, HandleObject, HandleValue, HandleValueArray};
use js::jsapi::{INTERNED_STRING_TO_JSID, IsCallable, JS_CallFunctionValue};
use js::jsapi::{JSContext, JSClass, JSFreeOp, JSFunctionSpec, JSJitGetterCallArgs};
use js::jsapi::{JSJitInfo, JSJitMethodCallArgs, JSJitSetterCallArgs, JSNative};
use js::jsapi::{JSObject, JSNativeWrapper, JSPropertyDescriptor, JSPropertySpec};
use js::jsapi::{JSString, JSTracer, JSType, JSTypedMethodJitInfo, JSValueType};
use js::jsapi::{JS_ComputeThis, JS_CopyPropertiesFrom, JS_ForwardGetPropertyTo};
use js::jsapi::{JS_GetClass, JS_GetGlobalForObject, JS_GetObjectPrototype};
use js::jsapi::{JS_GetProperty, JS_GetPropertyById, JS_GetPropertyDescriptorById};
use js::jsapi::{JS_GetReservedSlot, JS_HasProperty, JS_HasPropertyById};
use js::jsapi::{JS_InitializePropertiesFromCompatibleNativeObject, JS_InternString};
use js::jsapi::{JS_IsExceptionPending, JS_NewObject, JS_NewObjectWithGivenProto};
use js::jsapi::{JS_NewObjectWithoutMetadata, JS_SetProperty, JS_SetPrototype};
use js::jsapi::{JS_SetReservedSlot, JS_WrapValue, JSAutoCompartment, JSAutoRequest};
use js::jsapi::{MutableHandleValue, RootedId, RootedObject, RootedString};
use js::jsapi::{ObjectOpResult, OpType, MutableHandle, MutableHandleObject};
use js::jsapi::{RootedValue, SymbolCode, jsid};
use js::jsval::JSVal;
use js::jsval::{NullValue, UndefinedValue};
use js::jsval::{ObjectValue, ObjectOrNullValue, PrivateValue};
use js::rust::{GCMethods, define_methods, define_properties};
use js::{JSCLASS_GLOBAL_SLOT_COUNT, JSCLASS_IMPLEMENTS_BARRIERS};
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL, JSCLASS_RESERVED_SLOTS_MASK};
use js::{JSCLASS_RESERVED_SLOTS_SHIFT, JSITER_HIDDEN, JSITER_OWNONLY};
use js::{JSITER_SYMBOLS, JSPROP_ENUMERATE, JSPROP_PERMANENT, JSPROP_READONLY};
use js::{JSPROP_SHARED, JS_CALLEE};
use libc;
use mem::heap_size_of_raw_self_and_children;
use std::borrow::ToOwned;
use std::cmp;
use std::default::Default;
use std::ffi::CString;
use std::mem;
use std::num;
use std::ptr;
use std::rc;
use std::rc::Rc;
use std::str;
use util::str::DOMString;
pub struct BlobPropertyBag {
pub type_: DOMString,
}
impl BlobPropertyBag {
pub unsafe fn empty(cx: *mut JSContext) -> BlobPropertyBag {
BlobPropertyBag::new(cx, HandleValue::null()).unwrap()
}
pub unsafe fn new(cx: *mut JSContext, val: HandleValue) -> Result<BlobPropertyBag, ()> {
let object = if val.get().is_null_or_undefined() {
RootedObject::new(cx, ptr::null_mut())
} else if val.get().is_object() {
RootedObject::new(cx, val.get().to_object())
} else {
throw_type_error(cx, "Value not an object.");
return Err(());
};
Ok(BlobPropertyBag {
type_: {
let mut rval = RootedValue::new(cx, UndefinedValue());
match try!(get_dictionary_property(cx, object.handle(), "type", rval.handle_mut())) {
true => {
match FromJSValConvertible::from_jsval(cx, rval.handle(), StringificationBehavior::Default) {
Ok(strval) => strval,
Err(_) => { return Err(()); },
}
},
false => {
DOMString::from("")
},
}
},
})
}
}
impl ToJSValConvertible for BlobPropertyBag {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
let obj = RootedObject::new(cx, JS_NewObject(cx, ptr::null()));
let mut type_ = RootedValue::new(cx, UndefinedValue());
self.type_.to_jsval(cx, type_.handle_mut());
set_dictionary_property(cx, obj.handle(), "type_", type_.handle()).unwrap();
rval.set(ObjectOrNullValue(obj.ptr))
}
}
pub fn GetProtoObject(cx: *mut JSContext, global: HandleObject, receiver: HandleObject, rval: MutableHandleObject) {
unsafe {
/* Get the interface prototype object for this class. This will create the
object as needed. */
/* global and receiver are usually the same, but they can be different
too. For example a sandbox often has an xray wrapper for a window as the
prototype of the sandbox's global. In that case receiver is the xray
wrapper and global is the sandbox's global.
*/
assert!(((*JS_GetClass(global.get())).flags & JSCLASS_DOM_GLOBAL) != 0);
/* Check to see whether the interface objects are already installed */
let proto_or_iface_array = get_proto_or_iface_array(global.get());
rval.set((*proto_or_iface_array)[PrototypeList::ID::Blob as usize]);
if !rval.get().is_null() {
return;
}
CreateInterfaceObjects(cx, global, receiver, rval);
assert!(!rval.get().is_null());
(*proto_or_iface_array)[PrototypeList::ID::Blob as usize] = rval.get();
if <*mut JSObject>::needs_post_barrier(rval.get()) {
<*mut JSObject>::post_barrier((*proto_or_iface_array).as_mut_ptr().offset(PrototypeList::ID::Blob as isize))
}
}
}
unsafe extern fn get_size(cx: *mut JSContext, _obj: HandleObject, this: *const Blob, args: JSJitGetterCallArgs) -> bool {
let this = &*this;
let result: u64 = this.Size();
(result).to_jsval(cx, args.rval());
return true;
}
const size_getterinfo: JSJitInfo = JSJitInfo {
call: get_size as *const ::libc::c_void,
protoID: PrototypeList::ID::Blob as u16,
depth: 0,
_bitfield_1:
JSJitInfo::new_bitfield_1(
OpType::Getter as u8,
AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
0 as u16,
)
};
unsafe extern fn get_type(cx: *mut JSContext, _obj: HandleObject, this: *const Blob, args: JSJitGetterCallArgs) -> bool {
let this = &*this;
let result: DOMString = this.Type();
(result).to_jsval(cx, args.rval());
return true;
}
const type_getterinfo: JSJitInfo = JSJitInfo {
call: get_type as *const ::libc::c_void,
protoID: PrototypeList::ID::Blob as u16,
depth: 0,
_bitfield_1:
JSJitInfo::new_bitfield_1(
OpType::Getter as u8,
AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
0 as u16,
)
};
unsafe extern fn get_isClosed(cx: *mut JSContext, _obj: HandleObject, this: *const Blob, args: JSJitGetterCallArgs) -> bool {
let this = &*this;
let result: bool = this.IsClosed();
(result).to_jsval(cx, args.rval());
return true;
}
const isClosed_getterinfo: JSJitInfo = JSJitInfo {
call: get_isClosed as *const ::libc::c_void,
protoID: PrototypeList::ID::Blob as u16,
depth: 0,
_bitfield_1:
JSJitInfo::new_bitfield_1(
OpType::Getter as u8,
AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_BOOLEAN as u8,
true,
false,
false,
false,
false,
0 as u16,
)
};
unsafe extern fn slice(cx: *mut JSContext, _obj: HandleObject, this: *const Blob, args: *const JSJitMethodCallArgs) -> bool {
let this = &*this;
let args = &*args;
let argc = args._base.argc_;
let arg0: Option<i64> = if args.get(0).is_undefined() {
None
} else {
Some(match FromJSValConvertible::from_jsval(cx, args.get(0), ConversionBehavior::Clamp) {
Ok(v) => v,
Err(_) => { return false; }
})
};
let arg1: Option<i64> = if args.get(1).is_undefined() {
None
} else {
Some(match FromJSValConvertible::from_jsval(cx, args.get(1), ConversionBehavior::Clamp) {
Ok(v) => v,
Err(_) => { return false; }
})
};
let arg2: Option<DOMString> = if args.get(2).is_undefined() {
None
} else {
Some(match FromJSValConvertible::from_jsval(cx, args.get(2), StringificationBehavior::Default) {
Ok(strval) => strval,
Err(_) => { return false; },
})
};
let result: Root<Blob> = this.Slice(arg0, arg1, arg2);
(result).to_jsval(cx, args.rval());
return true;
}
const slice_methodinfo: JSJitInfo = JSJitInfo {
call: slice as *const ::libc::c_void,
protoID: PrototypeList::ID::Blob as u16,
depth: 0,
_bitfield_1:
JSJitInfo::new_bitfield_1(
OpType::Method as u8,
AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
0 as u16,
)
};
unsafe extern fn close(cx: *mut JSContext, _obj: HandleObject, this: *const Blob, args: *const JSJitMethodCallArgs) -> bool {
let this = &*this;
let args = &*args;
let argc = args._base.argc_;
let result: () = this.Close();
(result).to_jsval(cx, args.rval());
return true;
}
const close_methodinfo: JSJitInfo = JSJitInfo {
call: close as *const ::libc::c_void,
protoID: PrototypeList::ID::Blob as u16,
depth: 0,
_bitfield_1:
JSJitInfo::new_bitfield_1(
OpType::Method as u8,
AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
true,
false,
false,
false,
false,
0 as u16,
)
};
unsafe extern fn _finalize(_fop: *mut FreeOp, obj: *mut JSObject) {
let this = native_from_object::<Blob>(obj).unwrap();
if !this.is_null() {
// The pointer can be null if the object is the unforgeable holder of that interface.
let _ = Box::from_raw(this as *mut Blob);
}
debug!("Blob finalize: {:p}", this);
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
let this = native_from_object::<Blob>(obj).unwrap();
if this.is_null() { return; } // GC during obj creation
(*this).trace(trc);
}
unsafe extern fn _constructor(cx: *mut JSContext, argc: u32, vp: *mut JSVal) -> bool {
let global = global_root_from_object(JS_CALLEE(cx, vp).to_object());
let args = CallArgs::from_vp(vp, argc);
let argcount = cmp::min(argc, 2);
match argcount {
0 => {
let result: Result<Root<Blob>, Error> = Blob::Constructor(global.r());
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, global.r(), e);
return false;
},
};
(result).to_jsval(cx, args.rval());
return true;
}
1 => {
let arg0: DOMString = match FromJSValConvertible::from_jsval(cx, args.get(0), StringificationBehavior::Default) {
Ok(strval) => strval,
Err(_) => { return false; },
};
let arg1: BlobBinding::BlobPropertyBag = if args.get(1).is_undefined() {
BlobBinding::BlobPropertyBag::empty(cx)
} else {
match BlobBinding::BlobPropertyBag::new(cx, args.get(1)) {
Ok(dictionary) => dictionary,
e => return e,
}
};
let result: Result<Root<Blob>, Error> = Blob::Constructor_(global.r(), arg0, &arg1);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, global.r(), e);
return false;
},
};
(result).to_jsval(cx, args.rval());
return true;
}
2 => {
let arg0: DOMString = match FromJSValConvertible::from_jsval(cx, args.get(0), StringificationBehavior::Default) {
Ok(strval) => strval,
Err(_) => { return false; },
};
let arg1: BlobBinding::BlobPropertyBag = if args.get(1).is_undefined() {
BlobBinding::BlobPropertyBag::empty(cx)
} else {
match BlobBinding::BlobPropertyBag::new(cx, args.get(1)) {
Ok(dictionary) => dictionary,
e => return e,
}
};
let result: Result<Root<Blob>, Error> = Blob::Constructor_(global.r(), arg0, &arg1);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, global.r(), e);
return false;
},
};
(result).to_jsval(cx, args.rval());
return true;
}
_ => {
throw_type_error(cx, "Not enough arguments to \"Blob.constructor\".");
return false;
}
}
}
static PrototypeClass: JSClass = JSClass {
name: b"BlobPrototype\0" as *const u8 as *const libc::c_char,
flags:
// JSCLASS_HAS_RESERVED_SLOTS(0)
(0 & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT,
addProperty: None,
delProperty: None,
getProperty: None,
setProperty: None,
enumerate: None,
resolve: None,
convert: None,
finalize: None,
call: None,
hasInstance: None,
construct: None,
trace: None,
reserved: [0 as *mut libc::c_void; 25]
};
const sMethods: &'static [JSFunctionSpec] = &[
JSFunctionSpec {
name: b"slice\0" as *const u8 as *const libc::c_char,
call: JSNativeWrapper { op: Some(generic_method), info: &slice_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: b"close\0" as *const u8 as *const libc::c_char,
call: JSNativeWrapper { op: Some(generic_method), info: &close_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: 0 as *const libc::c_char,
call: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
nargs: 0,
flags: 0,
selfHostedName: 0 as *const libc::c_char
}
];
const sAttributes: &'static [JSPropertySpec] = &[
JSPropertySpec {
name: b"size\0" as *const u8 as *const libc::c_char,
flags: ((JSPROP_ENUMERATE | JSPROP_SHARED) & 0xFF) as u8,
getter: JSNativeWrapper { op: Some(generic_getter), info: &size_getterinfo },
setter: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo }
},
JSPropertySpec {
name: b"type\0" as *const u8 as *const libc::c_char,
flags: ((JSPROP_ENUMERATE | JSPROP_SHARED) & 0xFF) as u8,
getter: JSNativeWrapper { op: Some(generic_getter), info: &type_getterinfo },
setter: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo }
},
JSPropertySpec {
name: b"isClosed\0" as *const u8 as *const libc::c_char,
flags: ((JSPROP_ENUMERATE | JSPROP_SHARED) & 0xFF) as u8,
getter: JSNativeWrapper { op: Some(generic_getter), info: &isClosed_getterinfo },
setter: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo }
},
JSPropertySpec {
name: 0 as *const libc::c_char,
flags: 0,
getter: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
setter: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo }
}
];
static sNativeProperties: NativeProperties = NativeProperties {
static_methods: None,
static_attrs: None,
methods: Some(sMethods),
unforgeable_methods: None,
attrs: Some(sAttributes),
unforgeable_attrs: None,
consts: None,
};
pub static sNativePropertyHooks: NativePropertyHooks = NativePropertyHooks {
native_properties: &sNativeProperties,
proto_hooks: None,
};
fn CreateInterfaceObjects(cx: *mut JSContext, global: HandleObject, receiver: HandleObject, rval: MutableHandleObject) {
unsafe {
let mut parent_proto = RootedObject::new(cx, ptr::null_mut());
parent_proto.ptr = JS_GetObjectPrototype(cx, global);
assert!(!parent_proto.ptr.is_null());
let named_constructors: [(NonNullJSNative, &'static str, u32); 0] = [
];
do_create_interface_objects(cx, receiver, parent_proto.handle(),
Some(&PrototypeClass), Some((_constructor as NonNullJSNative, "Blob", 0)),
&named_constructors,
&sNativeProperties, rval);
}
}
pub mod BlobConstants {
} // mod BlobConstants
pub fn DefineDOMInterface(cx: *mut JSContext, global: HandleObject) {
assert!(!global.get().is_null());
let mut proto = RootedObject::new(cx, ptr::null_mut());
GetProtoObject(cx, global, global, proto.handle_mut());
assert!(!proto.ptr.is_null());
}
static Class: DOMJSClass = DOMJSClass {
base: js::jsapi::Class {
name: b"Blob\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_IMPLEMENTS_BARRIERS | 0 |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) <<
JSCLASS_RESERVED_SLOTS_SHIFT), //JSCLASS_HAS_RESERVED_SLOTS(1),
addProperty: None,
delProperty: None,
getProperty: None,
setProperty: None,
enumerate: None,
resolve: None,
convert: None,
finalize: Some(_finalize),
call: None,
hasInstance: None,
construct: None,
trace: Some(_trace),
spec: js::jsapi::ClassSpec {
createConstructor: None,
createPrototype: None,
constructorFunctions: 0 as *const js::jsapi::JSFunctionSpec,
constructorProperties: 0 as *const js::jsapi::JSPropertySpec,
prototypeFunctions: 0 as *const js::jsapi::JSFunctionSpec,
prototypeProperties: 0 as *const js::jsapi::JSPropertySpec,
finishInit: None,
flags: 0,
},
ext: js::jsapi::ClassExtension {
outerObject: None,
innerObject: None,
isWrappedNative: false,
weakmapKeyDelegateOp: None,
objectMovedOp: None,
},
ops: js::jsapi::ObjectOps {
lookupProperty: None,
defineProperty: None,
hasProperty: None,
getProperty: None,
setProperty: None,
getOwnPropertyDescriptor: None,
deleteProperty: None,
watch: None,
unwatch: None,
getElements: None,
enumerate: None,
thisObject: None,
},
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::Blob, PrototypeList::ID::Count, PrototypeList::ID::Count, PrototypeList::ID::Count, PrototypeList::ID::Count, PrototypeList::ID::Count ],
native_hooks: &sNativePropertyHooks,
type_id: ::dom::bindings::codegen::InheritTypes::TopTypeId::Blob(::dom::bindings::codegen::InheritTypes::BlobTypeId::Blob),
heap_size_of: heap_size_of_raw_self_and_children::<Blob> as unsafe fn(_) -> _,
}
};
pub fn Wrap(cx: *mut JSContext, scope: GlobalRef, object: Box<Blob>) -> Root<Blob> {
unsafe {
let _ar = JSAutoRequest::new(cx);
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*JS_GetClass(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let mut proto = RootedObject::new(cx, ptr::null_mut());
let _ac = JSAutoCompartment::new(cx, scope.get());
GetProtoObject(cx, scope, scope, proto.handle_mut());
assert!(!proto.ptr.is_null());
let raw = Box::into_raw(object);
let _rt = RootedTraceable::new(&*raw);
let obj = RootedObject::new(cx, JS_NewObjectWithGivenProto(
cx, &Class.base as *const js::jsapi::Class as *const JSClass, proto.handle()));
assert!(!obj.ptr.is_null());
JS_SetReservedSlot(obj.ptr, DOM_OBJECT_SLOT,
PrivateValue(raw as *const libc::c_void));
(*raw).init_reflector(obj.ptr);
Root::from_ref(&*raw)
}
}
impl IDLInterface for Blob {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
class.interface_chain[0] == PrototypeList::ID::Blob
}
}
pub trait BlobMethods {
fn Size(&self) -> u64;
fn Type(&self) -> DOMString;
fn IsClosed(&self) -> bool;
fn Slice(&self, start: Option<i64>, end: Option<i64>, contentType: Option<DOMString>) -> Root<Blob>;
fn Close(&self) -> ();
} |
|
|
|
Thanks for coping with my bad explanations. |
Add DOMQuad element cc @nox Part of #8821 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8882) <!-- Reviewable:end -->
|
|
|
|
We'll need to add the DOMQuad interface to the list in mozilla/interfaces.html. |
|
The other failure is #9012. |
|
@bors-servo r+ Reviewed 1 of 1 files at r18. Comments from the review on Reviewable.io |
|
|
Add DOMQuad element cc @nox Part of #8821 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8882) <!-- Reviewable:end -->
|
|
|
@bors-servo: retry |
|
|
|
|
GuillaumeGomez commentedDec 7, 2015
cc @nox
Part of #8821