diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index f155362415d..8e04fc76a10 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -2375,9 +2375,9 @@ class CGConstructorEnabled(CGAbstractMethod): def CreateBindingJSObject(descriptor, parent=None): + assert not descriptor.isGlobal() create = "let raw = Box::into_raw(object);\nlet _rt = RootedTraceable::new(&*raw);\n" if descriptor.proxy: - assert not descriptor.isGlobal() create += """ let handler = RegisterBindings::proxy_handlers[PrototypeList::Proxies::%s as usize]; rooted!(in(cx) let private = PrivateValue(raw as *const libc::c_void)); @@ -2388,15 +2388,6 @@ let obj = NewProxyObject(cx, handler, assert!(!obj.is_null()); rooted!(in(cx) let obj = obj);\ """ % (descriptor.name, parent) - elif descriptor.isGlobal(): - create += ("rooted!(in(cx) let obj =\n" - " create_dom_global(\n" - " cx,\n" - " &Class.base as *const js::jsapi::Class as *const JSClass,\n" - " raw as *const libc::c_void,\n" - " Some(%s))\n" - ");\n" - "assert!(!obj.is_null());" % TRACE_HOOK_NAME) else: create += ("rooted!(in(cx) let obj = JS_NewObjectWithGivenProto(\n" " cx, &Class.base as *const js::jsapi::Class as *const JSClass, proto.handle()));\n" @@ -2475,21 +2466,17 @@ class CGWrapMethod(CGAbstractMethod): """ def __init__(self, descriptor): assert not descriptor.interface.isCallback() - if not descriptor.isGlobal(): - args = [Argument('*mut JSContext', 'cx'), Argument('GlobalRef', 'scope'), - Argument("Box<%s>" % descriptor.concreteType, 'object')] - else: - args = [Argument('*mut JSContext', 'cx'), - Argument("Box<%s>" % descriptor.concreteType, 'object')] + assert not descriptor.isGlobal() + args = [Argument('*mut JSContext', 'cx'), Argument('GlobalRef', 'scope'), + Argument("Box<%s>" % descriptor.concreteType, 'object')] retval = 'Root<%s>' % descriptor.concreteType CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args, pub=True, unsafe=True) def definition_body(self): unforgeable = CopyUnforgeablePropertiesToInstance(self.descriptor) - if not self.descriptor.isGlobal(): - create = CreateBindingJSObject(self.descriptor, "scope") - return CGGeneric("""\ + create = CreateBindingJSObject(self.descriptor, "scope") + return CGGeneric("""\ let scope = scope.reflector().get_jsobject(); assert!(!scope.get().is_null()); assert!(((*JS_GetClass(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0); @@ -2505,21 +2492,65 @@ assert!(!proto.is_null()); (*raw).init_reflector(obj.get()); Root::from_ref(&*raw)""" % {'copyUnforgeable': unforgeable, 'createObject': create}) - else: - create = CreateBindingJSObject(self.descriptor) - return CGGeneric("""\ -%(createObject)s + + +class CGWrapGlobalMethod(CGAbstractMethod): + """ + Class that generates the FooBinding::Wrap function for global interfaces. + """ + def __init__(self, descriptor, properties): + assert not descriptor.interface.isCallback() + assert descriptor.isGlobal() + args = [Argument('*mut JSContext', 'cx'), + Argument("Box<%s>" % descriptor.concreteType, 'object')] + retval = 'Root<%s>' % descriptor.concreteType + CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args, + pub=True, unsafe=True) + self.properties = properties + + def definition_body(self): + values = { + "unforgeable": CopyUnforgeablePropertiesToInstance(self.descriptor) + } + + pairs = [ + ("define_guarded_properties", self.properties.attrs), + ("define_guarded_methods", self.properties.methods), + ("define_guarded_constants", self.properties.consts) + ] + members = ["%s(cx, obj.handle(), %s);" % (function, array.variableName()) + for (function, array) in pairs if array.length() > 0] + values["members"] = "\n".join(members) + + return CGGeneric("""\ +let raw = Box::into_raw(object); +let _rt = RootedTraceable::new(&*raw); + +rooted!(in(cx) let mut obj = ptr::null_mut()); +create_global_object( + cx, + &*(&Class.base as *const js::jsapi::Class as *const _), + raw as *const libc::c_void, + _trace, + obj.handle_mut()); +assert!(!obj.is_null()); + (*raw).init_reflector(obj.get()); let _ac = JSAutoCompartment::new(cx, obj.get()); rooted!(in(cx) let mut proto = ptr::null_mut()); GetProtoObject(cx, obj.handle(), proto.handle_mut()); -JS_SplicePrototype(cx, obj.handle(), proto.handle()); +assert!(JS_SplicePrototype(cx, obj.handle(), proto.handle())); +let mut immutable = false; +assert!(JS_SetImmutablePrototype(cx, obj.handle(), &mut immutable)); +assert!(immutable); -%(copyUnforgeable)s +%(members)s + +%(unforgeable)s Root::from_ref(&*raw)\ -""" % {'copyUnforgeable': unforgeable, 'createObject': create}) +""" % values) class CGIDLInterface(CGThing): @@ -2663,6 +2694,18 @@ assert!(!prototype_proto.is_null());""" % getPrototypeProto)] else: properties[arrayName] = "&[]" + if self.descriptor.isGlobal(): + assert not self.haveUnscopables + proto_properties = { + "attrs": "&[]", + "consts": "&[]", + "id": name, + "methods": "&[]", + "unscopables": "&[]", + } + else: + proto_properties = properties + code.append(CGGeneric(""" rooted!(in(cx) let mut prototype = ptr::null_mut()); create_interface_prototype_object(cx, @@ -2679,7 +2722,7 @@ assert!((*cache)[PrototypeList::ID::%(id)s as usize].is_null()); <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::%(id)s as isize), ptr::null_mut(), prototype.get()); -""" % properties)) +""" % proto_properties)) if self.descriptor.interface.hasInterfaceObject(): properties["name"] = str_to_const_array(name) @@ -5249,26 +5292,26 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries 'js::{JS_CALLEE, JSCLASS_GLOBAL_SLOT_COUNT}', 'js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL, JSCLASS_RESERVED_SLOTS_MASK}', 'js::error::throw_type_error', - 'js::jsapi::{JSJitInfo_AliasSet, JSJitInfo_ArgType, AutoIdVector, CallArgs, FreeOp}', - 'js::jsapi::{JSITER_SYMBOLS, JSPROP_ENUMERATE, JSPROP_PERMANENT, JSPROP_READONLY, JSPROP_SHARED}', - 'js::jsapi::{JSCLASS_RESERVED_SLOTS_SHIFT, JSITER_HIDDEN, JSITER_OWNONLY}', - 'js::jsapi::{GetPropertyKeys, Handle, Call, GetWellKnownSymbol}', - 'js::jsapi::{HandleId, HandleObject, HandleValue, HandleValueArray}', - 'js::jsapi::{INTERNED_STRING_TO_JSID, IsCallable, JS_CallFunctionValue}', - 'js::jsapi::{JS_CopyPropertiesFrom, JS_ForwardGetPropertyTo}', - 'js::jsapi::{JS_GetClass, JS_GetErrorPrototype, JS_GetFunctionPrototype}', - 'js::jsapi::{JS_GetGlobalForObject, JS_GetObjectPrototype, JS_GetProperty}', - 'js::jsapi::{JS_GetPropertyById, JS_GetPropertyDescriptorById, JS_GetReservedSlot}', - 'js::jsapi::{JS_HasProperty, JS_HasPropertyById, JS_InitializePropertiesFromCompatibleNativeObject}', - 'js::jsapi::{JS_AtomizeAndPinString, JS_NewObject, JS_NewObjectWithGivenProto}', - 'js::jsapi::{JS_NewObjectWithoutMetadata, JS_SetProperty, JS_DefinePropertyById2}', - 'js::jsapi::{JS_SplicePrototype, JS_SetReservedSlot, JSAutoCompartment}', - 'js::jsapi::{JSContext, JSClass, JSFreeOp, JSFunctionSpec, JS_GetIteratorPrototype}', - 'js::jsapi::{JSJitGetterCallArgs, JSJitInfo, JSJitMethodCallArgs, JSJitSetterCallArgs}', - 'js::jsapi::{JSNative, JSObject, JSNativeWrapper, JSPropertySpec}', - 'js::jsapi::{JSString, JSTracer, JSType, JSTypedMethodJitInfo, JSValueType}', - 'js::jsapi::{ObjectOpResult, JSJitInfo_OpType, MutableHandle, MutableHandleObject}', - 'js::jsapi::{MutableHandleValue, PropertyDescriptor, RootedObject}', + 'js::jsapi::{AutoIdVector, Call, CallArgs, FreeOp, GetPropertyKeys, GetWellKnownSymbol}', + 'js::jsapi::{Handle, HandleId, HandleObject, HandleValue, HandleValueArray}', + 'js::jsapi::{INTERNED_STRING_TO_JSID, IsCallable, JS_AtomizeAndPinString}', + 'js::jsapi::{JS_CallFunctionValue, JS_CopyPropertiesFrom, JS_DefinePropertyById2}', + 'js::jsapi::{JS_ForwardGetPropertyTo, JS_GetClass, JS_GetErrorPrototype}', + 'js::jsapi::{JS_GetFunctionPrototype, JS_GetGlobalForObject, JS_GetIteratorPrototype}', + 'js::jsapi::{JS_GetObjectPrototype, JS_GetProperty, JS_GetPropertyById}', + 'js::jsapi::{JS_GetPropertyDescriptorById, JS_GetReservedSlot, JS_HasProperty}', + 'js::jsapi::{JS_HasPropertyById, JS_InitializePropertiesFromCompatibleNativeObject}', + 'js::jsapi::{JS_NewObject, JS_NewObjectWithGivenProto, JS_NewObjectWithoutMetadata}', + 'js::jsapi::{JS_SetImmutablePrototype, JS_SetProperty, JS_SetReservedSlot}', + 'js::jsapi::{JS_SplicePrototype, JSAutoCompartment, JSCLASS_RESERVED_SLOTS_SHIFT}', + 'js::jsapi::{JSClass, JSContext, JSFreeOp, JSFunctionSpec, JSITER_HIDDEN}', + 'js::jsapi::{JSITER_OWNONLY, JSITER_SYMBOLS, JSJitGetterCallArgs, JSJitInfo}', + 'js::jsapi::{JSJitInfo_AliasSet, JSJitInfo_ArgType, JSJitInfo_OpType}', + 'js::jsapi::{JSJitMethodCallArgs, JSJitSetterCallArgs, JSNative, JSNativeWrapper}', + 'js::jsapi::{JSObject, JSPROP_ENUMERATE, JSPROP_PERMANENT, JSPROP_READONLY}', + 'js::jsapi::{JSPROP_SHARED, JSPropertySpec, JSString, JSTracer, JSType}', + 'js::jsapi::{JSTypedMethodJitInfo, JSValueType, MutableHandle, MutableHandleObject}', + 'js::jsapi::{MutableHandleValue, ObjectOpResult, PropertyDescriptor, RootedObject}', 'js::jsapi::{SymbolCode, jsid}', 'js::jsval::JSVal', 'js::jsval::{ObjectValue, ObjectOrNullValue, PrivateValue}', @@ -5282,26 +5325,26 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries 'dom::bindings', 'dom::bindings::codegen::InterfaceObjectMap', 'dom::bindings::global::{GlobalRef, global_root_from_object, global_root_from_reflector}', - 'dom::bindings::interface::{InterfaceConstructorBehavior, NonCallbackInterfaceObjectClass}', - 'dom::bindings::interface::{create_callback_interface_object, create_interface_prototype_object}', - 'dom::bindings::interface::{create_named_constructors, create_noncallback_interface_object}', - 'dom::bindings::interface::{define_guarded_methods, define_guarded_properties}', - 'dom::bindings::interface::{ConstantSpec, NonNullJSNative}', + 'dom::bindings::interface::{ConstantSpec, InterfaceConstructorBehavior}', + 'dom::bindings::interface::{NonCallbackInterfaceObjectClass, NonNullJSNative}', + 'dom::bindings::interface::{create_callback_interface_object, create_global_object}', + 'dom::bindings::interface::{create_interface_prototype_object, create_named_constructors}', + 'dom::bindings::interface::{create_noncallback_interface_object, define_guarded_constants}', + 'dom::bindings::interface::{define_guarded_methods, define_guarded_properties, is_exposed_in}', 'dom::bindings::interface::ConstantVal::{IntVal, UintVal}', - 'dom::bindings::interface::is_exposed_in', 'dom::bindings::iterable::{IteratorType, Iterable}', 'dom::bindings::js::{JS, Root, RootedReference}', 'dom::bindings::js::{OptionalRootedReference}', 'dom::bindings::reflector::{Reflectable}', 'dom::bindings::utils::{DOMClass, DOMJSClass}', 'dom::bindings::utils::{DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, JSCLASS_DOM_GLOBAL}', - 'dom::bindings::utils::{ProtoOrIfaceArray, create_dom_global}', - 'dom::bindings::utils::{enumerate_global, finalize_global, find_enum_string_index}', - 'dom::bindings::utils::{generic_getter, generic_lenient_getter, generic_lenient_setter}', - 'dom::bindings::utils::{generic_method, generic_setter, get_array_index_from_id}', - 'dom::bindings::utils::{get_dictionary_property, get_property_on_prototype}', - 'dom::bindings::utils::{get_proto_or_iface_array, has_property_on_prototype}', - 'dom::bindings::utils::{is_platform_object, resolve_global, set_dictionary_property, trace_global}', + 'dom::bindings::utils::{ProtoOrIfaceArray, enumerate_global, finalize_global}', + 'dom::bindings::utils::{find_enum_string_index, generic_getter, generic_lenient_getter}', + 'dom::bindings::utils::{generic_lenient_setter, generic_method, generic_setter}', + 'dom::bindings::utils::{get_array_index_from_id, get_dictionary_property}', + 'dom::bindings::utils::{get_property_on_prototype, get_proto_or_iface_array}', + 'dom::bindings::utils::{has_property_on_prototype, is_platform_object}', + 'dom::bindings::utils::{resolve_global, set_dictionary_property, trace_global}', 'dom::bindings::trace::{JSTraceable, RootedTraceable}', 'dom::bindings::callback::{CallbackContainer,CallbackInterface,CallbackFunction}', 'dom::bindings::callback::{CallSetup,ExceptionHandling}', @@ -5437,6 +5480,8 @@ class CGDescriptor(CGThing): if descriptor.proxy: cgThings.append(CGDefineProxyHandler(descriptor)) + properties = PropertyArrays(descriptor) + if descriptor.concrete: if descriptor.proxy: # cgThings.append(CGProxyIsProxy(descriptor)) @@ -5466,7 +5511,10 @@ class CGDescriptor(CGThing): cgThings.append(CGDOMJSClass(descriptor)) pass - cgThings.append(CGWrapMethod(descriptor)) + if descriptor.isGlobal(): + cgThings.append(CGWrapGlobalMethod(descriptor, properties)) + else: + cgThings.append(CGWrapMethod(descriptor)) reexports.append('Wrap') haveUnscopables = False @@ -5489,7 +5537,6 @@ class CGDescriptor(CGThing): if descriptor.weakReferenceable: cgThings.append(CGWeakReferenceableTrait(descriptor)) - properties = PropertyArrays(descriptor) cgThings.append(CGGeneric(str(properties))) cgThings.append(CGCreateInterfaceObjectsMethod(descriptor, properties, haveUnscopables)) diff --git a/components/script/dom/bindings/interface.rs b/components/script/dom/bindings/interface.rs index 3b2b5dbde36..1e21c3db651 100644 --- a/components/script/dom/bindings/interface.rs +++ b/components/script/dom/bindings/interface.rs @@ -6,23 +6,26 @@ use dom::bindings::codegen::InterfaceObjectMap::Globals; use dom::bindings::codegen::PrototypeList; -use dom::bindings::conversions::get_dom_class; +use dom::bindings::conversions::{DOM_OBJECT_SLOT, get_dom_class}; use dom::bindings::guard::Guard; -use dom::bindings::utils::get_proto_or_iface_array; +use dom::bindings::utils::{DOM_PROTOTYPE_SLOT, ProtoOrIfaceArray, get_proto_or_iface_array}; use js::error::throw_type_error; use js::glue::{RUST_SYMBOL_TO_JSID, UncheckedUnwrapObject}; -use js::jsapi::{Class, ClassOps, GetGlobalForObjectCrossCompartment}; -use js::jsapi::{GetWellKnownSymbol, HandleObject, HandleValue, JSClass, JSContext}; -use js::jsapi::{JSFunctionSpec, JSNative, JSFUN_CONSTRUCTOR, JSPROP_ENUMERATE}; -use js::jsapi::{JSPROP_PERMANENT, JSPROP_READONLY, JSPROP_RESOLVING, JSPropertySpec}; -use js::jsapi::{JSString, JS_AtomizeAndPinString, JS_DefineProperty, JS_DefineProperty1}; -use js::jsapi::{JS_DefineProperty2, JS_DefineProperty4, JS_DefinePropertyById3}; -use js::jsapi::{JS_GetClass, JS_GetFunctionObject, JS_GetPrototype, JS_LinkConstructorAndPrototype}; -use js::jsapi::{JS_NewFunction, JS_NewObject, JS_NewObjectWithUniqueType}; -use js::jsapi::{JS_NewPlainObject, JS_NewStringCopyN, MutableHandleObject}; -use js::jsapi::{MutableHandleValue, ObjectOps}; -use js::jsapi::{SymbolCode, TrueHandleValue, Value}; -use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, NullValue, UInt32Value}; +use js::jsapi::{Class, ClassOps, CompartmentOptions, GetGlobalForObjectCrossCompartment}; +use js::jsapi::{GetWellKnownSymbol, HandleObject, HandleValue, JSAutoCompartment}; +use js::jsapi::{JSClass, JSContext, JSFUN_CONSTRUCTOR, JSFunctionSpec, JSNative, JSObject}; +use js::jsapi::{JSPROP_ENUMERATE, JSPROP_PERMANENT, JSPROP_READONLY, JSPROP_RESOLVING}; +use js::jsapi::{JSPropertySpec, JSString, JSTracer, JSVersion, JS_AtomizeAndPinString}; +use js::jsapi::{JS_DefineProperty, JS_DefineProperty1, JS_DefineProperty2}; +use js::jsapi::{JS_DefineProperty4, JS_DefinePropertyById3, JS_FireOnNewGlobalObject}; +use js::jsapi::{JS_GetClass, JS_GetFunctionObject, JS_GetPrototype}; +use js::jsapi::{JS_LinkConstructorAndPrototype, JS_NewFunction, JS_NewGlobalObject}; +use js::jsapi::{JS_NewObject, JS_NewObjectWithUniqueType, JS_NewPlainObject}; +use js::jsapi::{JS_NewStringCopyN, JS_SetReservedSlot, MutableHandleObject}; +use js::jsapi::{MutableHandleValue, ObjectOps, OnNewGlobalHookOption, SymbolCode}; +use js::jsapi::{TrueHandleValue, Value}; +use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, NullValue}; +use js::jsval::{PrivateValue, UInt32Value}; use js::rust::{define_methods, define_properties}; use libc; use std::ptr; @@ -70,21 +73,19 @@ pub type NonNullJSNative = /// Defines constants on `obj`. /// Fails on JSAPI failure. -fn define_constants( +unsafe fn define_constants( cx: *mut JSContext, obj: HandleObject, constants: &[ConstantSpec]) { for spec in constants { rooted!(in(cx) let value = spec.get_value()); - unsafe { - assert!(JS_DefineProperty(cx, - obj, - spec.name.as_ptr() as *const libc::c_char, - value.handle(), - JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT, - None, - None)); - } + assert!(JS_DefineProperty(cx, + obj, + spec.name.as_ptr() as *const libc::c_char, + value.handle(), + JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT, + None, + None)); } } @@ -208,6 +209,44 @@ impl InterfaceConstructorBehavior { } } +/// A trace hook. +pub type TraceHook = + unsafe extern "C" fn(trc: *mut JSTracer, obj: *mut JSObject); + +/// Create a global object with the given class. +pub unsafe fn create_global_object( + cx: *mut JSContext, + class: &'static JSClass, + private: *const libc::c_void, + trace: TraceHook, + rval: MutableHandleObject) { + assert!(rval.is_null()); + + let mut options = CompartmentOptions::default(); + options.behaviors_.version_ = JSVersion::JSVERSION_ECMA_5; + options.creationOptions_.traceGlobal_ = Some(trace); + options.creationOptions_.sharedMemoryAndAtomics_ = true; + + rval.set(JS_NewGlobalObject(cx, + class, + ptr::null_mut(), + OnNewGlobalHookOption::DontFireOnNewGlobalHook, + &options)); + assert!(!rval.is_null()); + + // Initialize the reserved slots before doing anything that can GC, to + // avoid getting trace hooks called on a partially initialized object. + JS_SetReservedSlot(rval.get(), DOM_OBJECT_SLOT, PrivateValue(private)); + let proto_array: Box = + box [0 as *mut JSObject; PrototypeList::PROTO_OR_IFACE_LENGTH]; + JS_SetReservedSlot(rval.get(), + DOM_PROTOTYPE_SLOT, + PrivateValue(Box::into_raw(proto_array) as *const libc::c_void)); + + let _ac = JSAutoCompartment::new(cx, rval.get()); + JS_FireOnNewGlobalObject(cx, rval.handle()); +} + /// Create and define the interface object of a callback interface. pub unsafe fn create_callback_interface_object( cx: *mut JSContext, @@ -218,11 +257,7 @@ pub unsafe fn create_callback_interface_object( assert!(!constants.is_empty()); rval.set(JS_NewObject(cx, ptr::null())); assert!(!rval.ptr.is_null()); - for guard in constants { - if let Some(specs) = guard.expose(cx, rval.handle()) { - define_constants(cx, rval.handle(), specs); - } - } + define_guarded_constants(cx, rval.handle(), constants); define_name(cx, rval.handle(), name); define_on_global_object(cx, global, name, rval.handle()); } @@ -382,11 +417,7 @@ unsafe fn create_object( assert!(!rval.ptr.is_null()); define_guarded_methods(cx, rval.handle(), methods); define_guarded_properties(cx, rval.handle(), properties); - for guard in constants { - if let Some(specs) = guard.expose(cx, rval.handle()) { - define_constants(cx, rval.handle(), specs); - } - } + define_guarded_constants(cx, rval.handle(), constants); } unsafe fn create_unscopable_object( @@ -405,6 +436,18 @@ unsafe fn create_unscopable_object( } } +/// Conditionally define constants on an object. +pub unsafe fn define_guarded_constants( + cx: *mut JSContext, + obj: HandleObject, + constants: &[Guard<&[ConstantSpec]>]) { + for guard in constants { + if let Some(specs) = guard.expose(cx, obj) { + define_constants(cx, obj, specs); + } + } +} + /// Conditionally define methods on an object. pub unsafe fn define_guarded_methods( cx: *mut JSContext, diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs index 6b2856e7a9e..ac902a5d68c 100644 --- a/components/script/dom/bindings/utils.rs +++ b/components/script/dom/bindings/utils.rs @@ -7,8 +7,7 @@ use dom::bindings::codegen::InterfaceObjectMap; use dom::bindings::codegen::PrototypeList; use dom::bindings::codegen::PrototypeList::{MAX_PROTO_CHAIN_LENGTH, PROTO_OR_IFACE_LENGTH}; -use dom::bindings::conversions::{DOM_OBJECT_SLOT, is_dom_class}; -use dom::bindings::conversions::{jsstring_to_str, private_from_proto_check}; +use dom::bindings::conversions::{is_dom_class, jsstring_to_str, private_from_proto_check}; use dom::bindings::error::throw_invalid_this; use dom::bindings::inheritance::TopTypeId; use dom::bindings::str::DOMString; @@ -21,20 +20,18 @@ use js::glue::{CallJitGetterOp, CallJitMethodOp, CallJitSetterOp, IsWrapper}; use js::glue::{GetCrossCompartmentWrapper, WrapperNew}; use js::glue::{RUST_FUNCTION_VALUE_TO_JITINFO, RUST_JSID_IS_INT, RUST_JSID_IS_STRING}; use js::glue::{RUST_JSID_TO_INT, RUST_JSID_TO_STRING, UnwrapObject}; -use js::jsapi::{CallArgs, CompartmentOptions, DOMCallbacks, GetGlobalForObjectCrossCompartment}; -use js::jsapi::{HandleId, HandleObject, HandleValue, Heap, JSAutoCompartment, JSClass, JSContext}; -use js::jsapi::{JSJitInfo, JSObject, JSTraceOp, JSTracer, JSVersion, JSWrapObjectCallbacks}; -use js::jsapi::{JS_DeletePropertyById, JS_EnumerateStandardClasses, JS_FireOnNewGlobalObject}; +use js::jsapi::{CallArgs, DOMCallbacks, GetGlobalForObjectCrossCompartment}; +use js::jsapi::{HandleId, HandleObject, HandleValue, Heap, JSAutoCompartment, JSContext}; +use js::jsapi::{JSJitInfo, JSObject, JSTracer, JSWrapObjectCallbacks}; +use js::jsapi::{JS_DeletePropertyById, JS_EnumerateStandardClasses}; use js::jsapi::{JS_ForwardGetPropertyTo, JS_GetClass, JS_GetLatin1StringCharsAndLength}; use js::jsapi::{JS_GetProperty, JS_GetPrototype, JS_GetReservedSlot, JS_HasProperty}; -use js::jsapi::{JS_HasPropertyById, JS_IsExceptionPending, JS_IsGlobalObject, JS_NewGlobalObject}; +use js::jsapi::{JS_HasPropertyById, JS_IsExceptionPending, JS_IsGlobalObject}; use js::jsapi::{JS_ResolveStandardClass, JS_SetProperty, ToWindowProxyIfWindow}; -use js::jsapi::{JS_SetReservedSlot, JS_StringHasLatin1Chars, MutableHandleValue}; -use js::jsapi::{ObjectOpResult, OnNewGlobalHookOption}; -use js::jsval::{JSVal, ObjectValue, PrivateValue, UndefinedValue}; +use js::jsapi::{JS_StringHasLatin1Chars, MutableHandleValue, ObjectOpResult}; +use js::jsval::{JSVal, ObjectValue, UndefinedValue}; use js::rust::{GCMethods, ToString}; use libc; -use std::default::Default; use std::ffi::CString; use std::os::raw::c_void; use std::ptr; @@ -296,43 +293,6 @@ pub fn has_property_on_prototype(cx: *mut JSContext, proxy: HandleObject, id: Ha }) || found } -/// Create a DOM global object with the given class. -pub fn create_dom_global(cx: *mut JSContext, - class: *const JSClass, - private: *const libc::c_void, - trace: JSTraceOp) - -> *mut JSObject { - unsafe { - let mut options = CompartmentOptions::default(); - options.behaviors_.version_ = JSVersion::JSVERSION_ECMA_5; - options.creationOptions_.traceGlobal_ = trace; - options.creationOptions_.sharedMemoryAndAtomics_ = true; - - rooted!(in(cx) let obj = - JS_NewGlobalObject(cx, - class, - ptr::null_mut(), - OnNewGlobalHookOption::DontFireOnNewGlobalHook, - &options)); - if obj.is_null() { - return ptr::null_mut(); - } - - // Initialize the reserved slots before doing amything that can GC, to - // avoid getting trace hooks called on a partially initialized object. - JS_SetReservedSlot(obj.get(), DOM_OBJECT_SLOT, PrivateValue(private)); - let proto_array: Box = - box [0 as *mut JSObject; PROTO_OR_IFACE_LENGTH]; - JS_SetReservedSlot(obj.get(), - DOM_PROTOTYPE_SLOT, - PrivateValue(Box::into_raw(proto_array) as *const libc::c_void)); - - let _ac = JSAutoCompartment::new(cx, obj.get()); - JS_FireOnNewGlobalObject(cx, obj.handle()); - obj.get() - } -} - /// Drop the resources held by reserved slots of a global object pub unsafe fn finalize_global(obj: *mut JSObject) { let protolist = get_proto_or_iface_array(obj); diff --git a/tests/wpt/metadata-css/cssom-1_dev/html/interfaces.htm.ini b/tests/wpt/metadata-css/cssom-1_dev/html/interfaces.htm.ini index 828fc2e43c8..78d6184cd70 100644 --- a/tests/wpt/metadata-css/cssom-1_dev/html/interfaces.htm.ini +++ b/tests/wpt/metadata-css/cssom-1_dev/html/interfaces.htm.ini @@ -75,9 +75,6 @@ [SVGElement interface: attribute style] expected: FAIL - [Window interface: operation getComputedStyle(Element,DOMString)] - expected: FAIL - [MediaList interface: existence and properties of interface object] expected: FAIL diff --git a/tests/wpt/metadata-css/cssom-view-1_dev/html/window-interface.htm.ini b/tests/wpt/metadata-css/cssom-view-1_dev/html/window-interface.htm.ini index c0f0f4e73b4..fb15f5287a8 100644 --- a/tests/wpt/metadata-css/cssom-view-1_dev/html/window-interface.htm.ini +++ b/tests/wpt/metadata-css/cssom-view-1_dev/html/window-interface.htm.ini @@ -6,6 +6,3 @@ [window_functions] expected: FAIL - [window_properties] - expected: FAIL - diff --git a/tests/wpt/metadata/html/browsers/the-window-object/window-properties.html.ini b/tests/wpt/metadata/html/browsers/the-window-object/window-properties.html.ini index 70ebb9ddda8..d131f05bb2c 100644 --- a/tests/wpt/metadata/html/browsers/the-window-object/window-properties.html.ini +++ b/tests/wpt/metadata/html/browsers/the-window-object/window-properties.html.ini @@ -1,8 +1,5 @@ [window-properties.html] type: testharness - [Window method: close] - expected: FAIL - [Window method: stop] expected: FAIL @@ -15,9 +12,6 @@ [Window method: open] expected: FAIL - [Window method: alert] - expected: FAIL - [Window method: confirm] expected: FAIL @@ -27,276 +21,24 @@ [Window method: print] expected: FAIL - [Window method: postMessage] - expected: FAIL - - [Window method: btoa] - expected: FAIL - - [Window method: atob] - expected: FAIL - - [Window method: setTimeout] - expected: FAIL - - [Window method: clearTimeout] - expected: FAIL - - [Window method: setInterval] - expected: FAIL - - [Window method: clearInterval] - expected: FAIL - [Window method: getSelection] expected: FAIL - [Window method: getComputedStyle] - expected: FAIL - [Window method: matchMedia] expected: FAIL - [Window method: scroll] - expected: FAIL - - [Window method: scrollTo] - expected: FAIL - - [Window method: scrollBy] - expected: FAIL - - [Window readonly attribute: history] - expected: FAIL - - [Window readonly attribute: frameElement] - expected: FAIL - - [Window readonly attribute: navigator] - expected: FAIL - [Window readonly attribute: applicationCache] expected: FAIL - [Window readonly attribute: sessionStorage] - expected: FAIL - - [Window readonly attribute: localStorage] - expected: FAIL - [Window attribute: name] expected: FAIL - [Window attribute: status] - expected: FAIL - [Window attribute: opener] expected: FAIL - [Window attribute: onabort] - expected: FAIL - - [Window attribute: onafterprint] - expected: FAIL - - [Window attribute: onbeforeprint] - expected: FAIL - - [Window attribute: onbeforeunload] - expected: FAIL - - [Window attribute: onblur] - expected: FAIL - - [Window attribute: oncancel] - expected: FAIL - - [Window attribute: oncanplay] - expected: FAIL - - [Window attribute: oncanplaythrough] - expected: FAIL - - [Window attribute: onchange] - expected: FAIL - - [Window attribute: onclick] - expected: FAIL - - [Window attribute: onclose] - expected: FAIL - - [Window attribute: oncontextmenu] - expected: FAIL - - [Window attribute: oncuechange] - expected: FAIL - - [Window attribute: ondblclick] - expected: FAIL - - [Window attribute: ondrag] - expected: FAIL - - [Window attribute: ondragend] - expected: FAIL - - [Window attribute: ondragenter] - expected: FAIL - - [Window attribute: ondragleave] - expected: FAIL - - [Window attribute: ondragover] - expected: FAIL - - [Window attribute: ondragstart] - expected: FAIL - - [Window attribute: ondrop] - expected: FAIL - - [Window attribute: ondurationchange] - expected: FAIL - - [Window attribute: onemptied] - expected: FAIL - - [Window attribute: onended] - expected: FAIL - - [Window attribute: onerror] - expected: FAIL - - [Window attribute: onfocus] - expected: FAIL - - [Window attribute: onhashchange] - expected: FAIL - - [Window attribute: oninput] - expected: FAIL - - [Window attribute: oninvalid] - expected: FAIL - - [Window attribute: onkeydown] - expected: FAIL - - [Window attribute: onkeypress] - expected: FAIL - - [Window attribute: onkeyup] - expected: FAIL - - [Window attribute: onload] - expected: FAIL - - [Window attribute: onloadeddata] - expected: FAIL - - [Window attribute: onloadedmetadata] - expected: FAIL - - [Window attribute: onloadstart] - expected: FAIL - - [Window attribute: onmessage] - expected: FAIL - - [Window attribute: onmousedown] - expected: FAIL - - [Window attribute: onmousemove] - expected: FAIL - - [Window attribute: onmouseout] - expected: FAIL - - [Window attribute: onmouseover] - expected: FAIL - - [Window attribute: onmouseup] - expected: FAIL - [Window attribute: onmousewheel] expected: FAIL - [Window attribute: onoffline] - expected: FAIL - - [Window attribute: ononline] - expected: FAIL - - [Window attribute: onpause] - expected: FAIL - - [Window attribute: onplay] - expected: FAIL - - [Window attribute: onplaying] - expected: FAIL - - [Window attribute: onpagehide] - expected: FAIL - - [Window attribute: onpageshow] - expected: FAIL - - [Window attribute: onpopstate] - expected: FAIL - - [Window attribute: onprogress] - expected: FAIL - - [Window attribute: onratechange] - expected: FAIL - - [Window attribute: onreset] - expected: FAIL - - [Window attribute: onresize] - expected: FAIL - - [Window attribute: onscroll] - expected: FAIL - - [Window attribute: onseeked] - expected: FAIL - - [Window attribute: onseeking] - expected: FAIL - - [Window attribute: onselect] - expected: FAIL - - [Window attribute: onshow] - expected: FAIL - - [Window attribute: onstalled] - expected: FAIL - - [Window attribute: onstorage] - expected: FAIL - - [Window attribute: onsubmit] - expected: FAIL - - [Window attribute: onsuspend] - expected: FAIL - - [Window attribute: ontimeupdate] - expected: FAIL - - [Window attribute: onunload] - expected: FAIL - - [Window attribute: onvolumechange] - expected: FAIL - - [Window attribute: onwaiting] - expected: FAIL - [Window unforgeable attribute: location] expected: FAIL diff --git a/tests/wpt/metadata/html/dom/interfaces.html.ini b/tests/wpt/metadata/html/dom/interfaces.html.ini index 9934d8567d6..c444dcc4a8a 100644 --- a/tests/wpt/metadata/html/dom/interfaces.html.ini +++ b/tests/wpt/metadata/html/dom/interfaces.html.ini @@ -4917,9 +4917,6 @@ [Window interface: attribute name] expected: FAIL - [Window interface: attribute history] - expected: FAIL - [Window interface: attribute locationbar] expected: FAIL @@ -4938,12 +4935,6 @@ [Window interface: attribute toolbar] expected: FAIL - [Window interface: attribute status] - expected: FAIL - - [Window interface: operation close()] - expected: FAIL - [Window interface: attribute closed] expected: FAIL @@ -4968,24 +4959,15 @@ [Window interface: attribute parent] expected: FAIL - [Window interface: attribute frameElement] - expected: FAIL - [Window interface: operation open(DOMString,DOMString,DOMString,boolean)] expected: FAIL - [Window interface: attribute navigator] - expected: FAIL - [Window interface: attribute external] expected: FAIL [Window interface: attribute applicationCache] expected: FAIL - [Window interface: operation alert()] - expected: FAIL - [Window interface: operation confirm(DOMString)] expected: FAIL @@ -4998,288 +4980,27 @@ [Window interface: operation showModalDialog(DOMString,any)] expected: FAIL - [Window interface: operation postMessage(any,DOMString,[object Object\])] - expected: FAIL - - [Window interface: operation captureEvents()] - expected: FAIL - - [Window interface: operation releaseEvents()] - expected: FAIL - - [Window interface: attribute onabort] - expected: FAIL - [Window interface: attribute onautocomplete] expected: FAIL [Window interface: attribute onautocompleteerror] expected: FAIL - [Window interface: attribute onblur] - expected: FAIL - - [Window interface: attribute oncancel] - expected: FAIL - - [Window interface: attribute oncanplay] - expected: FAIL - - [Window interface: attribute oncanplaythrough] - expected: FAIL - - [Window interface: attribute onchange] - expected: FAIL - - [Window interface: attribute onclick] - expected: FAIL - - [Window interface: attribute onclose] - expected: FAIL - - [Window interface: attribute oncontextmenu] - expected: FAIL - - [Window interface: attribute oncuechange] - expected: FAIL - - [Window interface: attribute ondblclick] - expected: FAIL - - [Window interface: attribute ondrag] - expected: FAIL - - [Window interface: attribute ondragend] - expected: FAIL - - [Window interface: attribute ondragenter] - expected: FAIL - - [Window interface: attribute ondragexit] - expected: FAIL - - [Window interface: attribute ondragleave] - expected: FAIL - - [Window interface: attribute ondragover] - expected: FAIL - - [Window interface: attribute ondragstart] - expected: FAIL - - [Window interface: attribute ondrop] - expected: FAIL - - [Window interface: attribute ondurationchange] - expected: FAIL - - [Window interface: attribute onemptied] - expected: FAIL - - [Window interface: attribute onended] - expected: FAIL - - [Window interface: attribute onerror] - expected: FAIL - - [Window interface: attribute onfocus] - expected: FAIL - - [Window interface: attribute oninput] - expected: FAIL - - [Window interface: attribute oninvalid] - expected: FAIL - - [Window interface: attribute onkeydown] - expected: FAIL - - [Window interface: attribute onkeypress] - expected: FAIL - - [Window interface: attribute onkeyup] - expected: FAIL - - [Window interface: attribute onload] - expected: FAIL - - [Window interface: attribute onloadeddata] - expected: FAIL - - [Window interface: attribute onloadedmetadata] - expected: FAIL - - [Window interface: attribute onloadstart] - expected: FAIL - - [Window interface: attribute onmousedown] - expected: FAIL - - [Window interface: attribute onmouseenter] - expected: FAIL - - [Window interface: attribute onmouseleave] - expected: FAIL - - [Window interface: attribute onmousemove] - expected: FAIL - - [Window interface: attribute onmouseout] - expected: FAIL - - [Window interface: attribute onmouseover] - expected: FAIL - - [Window interface: attribute onmouseup] - expected: FAIL - [Window interface: attribute onmousewheel] expected: FAIL - [Window interface: attribute onpause] - expected: FAIL - - [Window interface: attribute onplay] - expected: FAIL - - [Window interface: attribute onplaying] - expected: FAIL - - [Window interface: attribute onprogress] - expected: FAIL - - [Window interface: attribute onratechange] - expected: FAIL - - [Window interface: attribute onreset] - expected: FAIL - - [Window interface: attribute onresize] - expected: FAIL - - [Window interface: attribute onscroll] - expected: FAIL - - [Window interface: attribute onseeked] - expected: FAIL - - [Window interface: attribute onseeking] - expected: FAIL - - [Window interface: attribute onselect] - expected: FAIL - - [Window interface: attribute onshow] - expected: FAIL - [Window interface: attribute onsort] expected: FAIL - [Window interface: attribute onstalled] - expected: FAIL - - [Window interface: attribute onsubmit] - expected: FAIL - - [Window interface: attribute onsuspend] - expected: FAIL - - [Window interface: attribute ontimeupdate] - expected: FAIL - - [Window interface: attribute ontoggle] - expected: FAIL - - [Window interface: attribute onvolumechange] - expected: FAIL - - [Window interface: attribute onwaiting] - expected: FAIL - - [Window interface: attribute onafterprint] - expected: FAIL - - [Window interface: attribute onbeforeprint] - expected: FAIL - - [Window interface: attribute onbeforeunload] - expected: FAIL - - [Window interface: attribute onhashchange] - expected: FAIL - - [Window interface: attribute onlanguagechange] - expected: FAIL - - [Window interface: attribute onmessage] - expected: FAIL - - [Window interface: attribute onoffline] - expected: FAIL - - [Window interface: attribute ononline] - expected: FAIL - - [Window interface: attribute onpagehide] - expected: FAIL - - [Window interface: attribute onpageshow] - expected: FAIL - - [Window interface: attribute onpopstate] - expected: FAIL - - [Window interface: attribute onstorage] - expected: FAIL - - [Window interface: attribute onunload] - expected: FAIL - - [Window interface: operation btoa(DOMString)] - expected: FAIL - - [Window interface: operation atob(DOMString)] - expected: FAIL - - [Window interface: operation setTimeout(Function,long,any)] - expected: FAIL - - [Window interface: operation setTimeout(DOMString,long,any)] - expected: FAIL - - [Window interface: operation clearTimeout(long)] - expected: FAIL - - [Window interface: operation setInterval(Function,long,any)] - expected: FAIL - - [Window interface: operation setInterval(DOMString,long,any)] - expected: FAIL - - [Window interface: operation clearInterval(long)] - expected: FAIL - [Window interface: operation createImageBitmap(ImageBitmapSource,long,long,long,long)] expected: FAIL - [Window interface: attribute sessionStorage] - expected: FAIL - - [Window interface: attribute localStorage] - expected: FAIL - - [Window interface: window must inherit property "self" with the proper type (1)] - expected: FAIL - [Window interface: window must inherit property "name" with the proper type (3)] expected: FAIL [Window interface: window must have own property "location"] expected: FAIL - [Window interface: window must inherit property "history" with the proper type (5)] - expected: FAIL - [Window interface: window must inherit property "locationbar" with the proper type (6)] expected: FAIL @@ -5298,9 +5019,6 @@ [Window interface: window must inherit property "toolbar" with the proper type (11)] expected: FAIL - [Window interface: window must inherit property "status" with the proper type (12)] - expected: FAIL - [Window interface: window must inherit property "closed" with the proper type (14)] expected: FAIL @@ -5313,18 +5031,12 @@ [Window interface: window must inherit property "blur" with the proper type (17)] expected: FAIL - [Window interface: window must inherit property "frames" with the proper type (18)] - expected: FAIL - [Window interface: window must inherit property "length" with the proper type (19)] expected: FAIL [Window interface: window must inherit property "opener" with the proper type (21)] expected: FAIL - [Window interface: window must inherit property "parent" with the proper type (22)] - expected: FAIL - [Window interface: window must inherit property "open" with the proper type (24)] expected: FAIL @@ -5358,225 +5070,18 @@ [Window interface: calling showModalDialog(DOMString,any) on window with too few arguments must throw TypeError] expected: FAIL - [Window interface: window must inherit property "postMessage" with the proper type (35)] - expected: FAIL - - [Window interface: calling postMessage(any,DOMString,[object Object\]) on window with too few arguments must throw TypeError] - expected: FAIL - - [Window interface: window must inherit property "captureEvents" with the proper type (36)] - expected: FAIL - - [Window interface: window must inherit property "releaseEvents" with the proper type (37)] - expected: FAIL - - [Window interface: window must inherit property "onabort" with the proper type (38)] - expected: FAIL - [Window interface: window must inherit property "onautocomplete" with the proper type (39)] expected: FAIL [Window interface: window must inherit property "onautocompleteerror" with the proper type (40)] expected: FAIL - [Window interface: window must inherit property "onblur" with the proper type (41)] - expected: FAIL - - [Window interface: window must inherit property "oncancel" with the proper type (42)] - expected: FAIL - - [Window interface: window must inherit property "oncanplay" with the proper type (43)] - expected: FAIL - - [Window interface: window must inherit property "oncanplaythrough" with the proper type (44)] - expected: FAIL - - [Window interface: window must inherit property "onclose" with the proper type (47)] - expected: FAIL - - [Window interface: window must inherit property "oncontextmenu" with the proper type (48)] - expected: FAIL - - [Window interface: window must inherit property "oncuechange" with the proper type (49)] - expected: FAIL - - [Window interface: window must inherit property "ondblclick" with the proper type (50)] - expected: FAIL - - [Window interface: window must inherit property "ondrag" with the proper type (51)] - expected: FAIL - - [Window interface: window must inherit property "ondragend" with the proper type (52)] - expected: FAIL - - [Window interface: window must inherit property "ondragenter" with the proper type (53)] - expected: FAIL - - [Window interface: window must inherit property "ondragexit" with the proper type (54)] - expected: FAIL - - [Window interface: window must inherit property "ondragleave" with the proper type (55)] - expected: FAIL - - [Window interface: window must inherit property "ondragover" with the proper type (56)] - expected: FAIL - - [Window interface: window must inherit property "ondragstart" with the proper type (57)] - expected: FAIL - - [Window interface: window must inherit property "ondrop" with the proper type (58)] - expected: FAIL - - [Window interface: window must inherit property "ondurationchange" with the proper type (59)] - expected: FAIL - - [Window interface: window must inherit property "onemptied" with the proper type (60)] - expected: FAIL - - [Window interface: window must inherit property "onended" with the proper type (61)] - expected: FAIL - - [Window interface: window must inherit property "onfocus" with the proper type (63)] - expected: FAIL - - [Window interface: window must inherit property "oninvalid" with the proper type (65)] - expected: FAIL - - [Window interface: window must inherit property "onkeydown" with the proper type (66)] - expected: FAIL - - [Window interface: window must inherit property "onkeypress" with the proper type (67)] - expected: FAIL - - [Window interface: window must inherit property "onkeyup" with the proper type (68)] - expected: FAIL - - [Window interface: window must inherit property "onloadeddata" with the proper type (70)] - expected: FAIL - - [Window interface: window must inherit property "onloadedmetadata" with the proper type (71)] - expected: FAIL - - [Window interface: window must inherit property "onloadstart" with the proper type (72)] - expected: FAIL - - [Window interface: window must inherit property "onmousedown" with the proper type (73)] - expected: FAIL - - [Window interface: window must inherit property "onmouseenter" with the proper type (74)] - expected: FAIL - - [Window interface: window must inherit property "onmouseleave" with the proper type (75)] - expected: FAIL - - [Window interface: window must inherit property "onmousemove" with the proper type (76)] - expected: FAIL - - [Window interface: window must inherit property "onmouseout" with the proper type (77)] - expected: FAIL - - [Window interface: window must inherit property "onmouseover" with the proper type (78)] - expected: FAIL - - [Window interface: window must inherit property "onmouseup" with the proper type (79)] - expected: FAIL - [Window interface: window must inherit property "onmousewheel" with the proper type (80)] expected: FAIL - [Window interface: window must inherit property "onpause" with the proper type (81)] - expected: FAIL - - [Window interface: window must inherit property "onplay" with the proper type (82)] - expected: FAIL - - [Window interface: window must inherit property "onplaying" with the proper type (83)] - expected: FAIL - - [Window interface: window must inherit property "onprogress" with the proper type (84)] - expected: FAIL - - [Window interface: window must inherit property "onratechange" with the proper type (85)] - expected: FAIL - - [Window interface: window must inherit property "onreset" with the proper type (86)] - expected: FAIL - - [Window interface: window must inherit property "onresize" with the proper type (87)] - expected: FAIL - - [Window interface: window must inherit property "onscroll" with the proper type (88)] - expected: FAIL - - [Window interface: window must inherit property "onseeked" with the proper type (89)] - expected: FAIL - - [Window interface: window must inherit property "onseeking" with the proper type (90)] - expected: FAIL - - [Window interface: window must inherit property "onselect" with the proper type (91)] - expected: FAIL - - [Window interface: window must inherit property "onshow" with the proper type (92)] - expected: FAIL - [Window interface: window must inherit property "onsort" with the proper type (93)] expected: FAIL - [Window interface: window must inherit property "onstalled" with the proper type (94)] - expected: FAIL - - [Window interface: window must inherit property "onsuspend" with the proper type (96)] - expected: FAIL - - [Window interface: window must inherit property "ontimeupdate" with the proper type (97)] - expected: FAIL - - [Window interface: window must inherit property "ontoggle" with the proper type (98)] - expected: FAIL - - [Window interface: window must inherit property "onvolumechange" with the proper type (99)] - expected: FAIL - - [Window interface: window must inherit property "onwaiting" with the proper type (100)] - expected: FAIL - - [Window interface: window must inherit property "onafterprint" with the proper type (101)] - expected: FAIL - - [Window interface: window must inherit property "onbeforeprint" with the proper type (102)] - expected: FAIL - - [Window interface: window must inherit property "onbeforeunload" with the proper type (103)] - expected: FAIL - - [Window interface: window must inherit property "onhashchange" with the proper type (104)] - expected: FAIL - - [Window interface: window must inherit property "onlanguagechange" with the proper type (105)] - expected: FAIL - - [Window interface: window must inherit property "onmessage" with the proper type (106)] - expected: FAIL - - [Window interface: window must inherit property "onoffline" with the proper type (107)] - expected: FAIL - - [Window interface: window must inherit property "ononline" with the proper type (108)] - expected: FAIL - - [Window interface: window must inherit property "onpagehide" with the proper type (109)] - expected: FAIL - - [Window interface: window must inherit property "onpageshow" with the proper type (110)] - expected: FAIL - - [Window interface: window must inherit property "onpopstate" with the proper type (111)] - expected: FAIL - - [Window interface: window must inherit property "onstorage" with the proper type (112)] - expected: FAIL - [Window interface: window must inherit property "createImageBitmap" with the proper type (122)] expected: FAIL @@ -6354,93 +5859,6 @@ [HTMLDirectoryElement interface: document.createElement("dir") must inherit property "compact" with the proper type (0)] expected: FAIL - [Window interface: window must inherit property "close" with the proper type (13)] - expected: FAIL - - [Window interface: window must inherit property "frameElement" with the proper type (23)] - expected: FAIL - - [Window interface: window must inherit property "navigator" with the proper type (27)] - expected: FAIL - - [Window interface: window must inherit property "alert" with the proper type (30)] - expected: FAIL - - [Window interface: window must inherit property "onchange" with the proper type (45)] - expected: FAIL - - [Window interface: window must inherit property "onclick" with the proper type (46)] - expected: FAIL - - [Window interface: window must inherit property "onerror" with the proper type (62)] - expected: FAIL - - [Window interface: window must inherit property "oninput" with the proper type (64)] - expected: FAIL - - [Window interface: window must inherit property "onload" with the proper type (69)] - expected: FAIL - - [Window interface: window must inherit property "onsubmit" with the proper type (95)] - expected: FAIL - - [Window interface: window must inherit property "onunload" with the proper type (113)] - expected: FAIL - - [Window interface: window must inherit property "btoa" with the proper type (114)] - expected: FAIL - - [Window interface: calling btoa(DOMString) on window with too few arguments must throw TypeError] - expected: FAIL - - [Window interface: window must inherit property "atob" with the proper type (115)] - expected: FAIL - - [Window interface: calling atob(DOMString) on window with too few arguments must throw TypeError] - expected: FAIL - - [Window interface: window must inherit property "setTimeout" with the proper type (116)] - expected: FAIL - - [Window interface: calling setTimeout(Function,long,any) on window with too few arguments must throw TypeError] - expected: FAIL - - [Window interface: window must inherit property "setTimeout" with the proper type (117)] - expected: FAIL - - [Window interface: calling setTimeout(DOMString,long,any) on window with too few arguments must throw TypeError] - expected: FAIL - - [Window interface: window must inherit property "clearTimeout" with the proper type (118)] - expected: FAIL - - [Window interface: calling clearTimeout(long) on window with too few arguments must throw TypeError] - expected: FAIL - - [Window interface: window must inherit property "setInterval" with the proper type (119)] - expected: FAIL - - [Window interface: calling setInterval(Function,long,any) on window with too few arguments must throw TypeError] - expected: FAIL - - [Window interface: window must inherit property "setInterval" with the proper type (120)] - expected: FAIL - - [Window interface: calling setInterval(DOMString,long,any) on window with too few arguments must throw TypeError] - expected: FAIL - - [Window interface: window must inherit property "clearInterval" with the proper type (121)] - expected: FAIL - - [Window interface: calling clearInterval(long) on window with too few arguments must throw TypeError] - expected: FAIL - - [Window interface: window must inherit property "sessionStorage" with the proper type (123)] - expected: FAIL - - [Window interface: window must inherit property "localStorage" with the proper type (124)] - expected: FAIL - [Location interface: window.location must have own property "replace"] expected: FAIL diff --git a/tests/wpt/metadata/html/webappapis/animation-frames/idlharness.html.ini b/tests/wpt/metadata/html/webappapis/animation-frames/idlharness.html.ini deleted file mode 100644 index 38d8e70fb8c..00000000000 --- a/tests/wpt/metadata/html/webappapis/animation-frames/idlharness.html.ini +++ /dev/null @@ -1,20 +0,0 @@ -[idlharness.html] - type: testharness - [Window interface: operation requestAnimationFrame(FrameRequestCallback)] - expected: FAIL - - [Window interface: operation cancelAnimationFrame(long)] - expected: FAIL - - [Window interface: window must inherit property "requestAnimationFrame" with the proper type (0)] - expected: FAIL - - [Window interface: calling requestAnimationFrame(FrameRequestCallback) on window with too few arguments must throw TypeError] - expected: FAIL - - [Window interface: window must inherit property "cancelAnimationFrame" with the proper type (1)] - expected: FAIL - - [Window interface: calling cancelAnimationFrame(long) on window with too few arguments must throw TypeError] - expected: FAIL - diff --git a/tests/wpt/metadata/navigation-timing/idlharness.html.ini b/tests/wpt/metadata/navigation-timing/idlharness.html.ini index c5b0f355386..8f3141197b8 100644 --- a/tests/wpt/metadata/navigation-timing/idlharness.html.ini +++ b/tests/wpt/metadata/navigation-timing/idlharness.html.ini @@ -3,9 +3,6 @@ [Window interface: attribute performance] expected: FAIL - [Window interface: window must inherit property "performance" with the proper type (0)] - expected: FAIL - [PerformanceTiming interface: attribute unloadEventStart] expected: FAIL diff --git a/tests/wpt/metadata/navigation-timing/test_readwrite.html.ini b/tests/wpt/metadata/navigation-timing/test_readwrite.html.ini new file mode 100644 index 00000000000..415ad0478a3 --- /dev/null +++ b/tests/wpt/metadata/navigation-timing/test_readwrite.html.ini @@ -0,0 +1,9 @@ +[test_readwrite.html] + type: testharness + bug: https://github.com/servo/servo/issues/13033 + [window.performance is read/write] + expected: FAIL + + [var performance is read/write] + expected: FAIL + diff --git a/tests/wpt/metadata/webstorage/idlharness.html.ini b/tests/wpt/metadata/webstorage/idlharness.html.ini deleted file mode 100644 index 6885750802e..00000000000 --- a/tests/wpt/metadata/webstorage/idlharness.html.ini +++ /dev/null @@ -1,8 +0,0 @@ -[idlharness.html] - type: testharness - [Window interface: attribute localStorage] - expected: FAIL - - [Window interface: attribute sessionStorage] - expected: FAIL - diff --git a/tests/wpt/metadata/workers/interfaces.worker.js.ini b/tests/wpt/metadata/workers/interfaces.worker.js.ini index 3928e5f88e0..eddc260926b 100644 --- a/tests/wpt/metadata/workers/interfaces.worker.js.ini +++ b/tests/wpt/metadata/workers/interfaces.worker.js.ini @@ -45,15 +45,6 @@ [WorkerLocation interface: self.location must inherit property "origin" with the proper type (1)] expected: FAIL - [DedicatedWorkerGlobalScope interface: self must inherit property "postMessage" with the proper type (0)] - expected: FAIL - - [DedicatedWorkerGlobalScope interface: calling postMessage(any,[object Object\]) on self with too few arguments must throw TypeError] - expected: FAIL - - [DedicatedWorkerGlobalScope interface: self must inherit property "onmessage" with the proper type (1)] - expected: FAIL - [WorkerNavigator interface: self.navigator must inherit property "languages" with the proper type (7)] expected: FAIL @@ -75,3 +66,6 @@ [WorkerLocation interface: existence and properties of interface object] expected: FAIL + [WorkerGlobalScope interface: self must inherit property "close" with the proper type (2)] + expected: FAIL +