aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-01-12 22:00:47 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2016-01-12 22:00:47 +0530
commite977a6e69a06ad69e87cc235b4ede60f8fb3eca3 (patch)
tree16f2a5d24406f306fa397278f5bac6d78be88762
parent53c4a782a0906c487139d4b6f3c62d9eca3f9f17 (diff)
parentd13da7d9b30a6671ed45e2f2c290405a5c92aafe (diff)
downloadservo-e977a6e69a06ad69e87cc235b4ede60f8fb3eca3.tar.gz
servo-e977a6e69a06ad69e87cc235b4ede60f8fb3eca3.zip
Auto merge of #8954 - nox:protochain, r=Ms2ger
Fix prototypes of interface objects (fixes #2665) Callback interface objects' (i.e. NodeFilter's) prototype is now Object instead of Function and non-callback interface objects' their proper ancestor, starting with the Function prototype. The function do_create_interface_objects is removed in favour of 4 functions: create_callback_interface_object, create_interface_prototype_object, create_noncallback_interface_object and create_named_constructors. While this increases the amount of codegen'd code, this greatly improves the readability of the code involved in this part of DOM, instead of having one function doing 4 different things. We can always find a more adequate abstraction later. NativeProperties and everything related to the interface objects have been removed from the utils module. Fixes #2665. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8954) <!-- Reviewable:end -->
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py423
-rw-r--r--components/script/dom/bindings/codegen/Configuration.py1
-rw-r--r--components/script/dom/bindings/interface.rs284
-rw-r--r--components/script/dom/bindings/mod.rs1
-rw-r--r--components/script/dom/bindings/utils.rs224
-rw-r--r--components/servo/Cargo.lock4
-rw-r--r--ports/cef/Cargo.lock4
-rw-r--r--ports/gonk/Cargo.lock4
-rw-r--r--tests/wpt/metadata/FileAPI/idlharness.html.ini6
-rw-r--r--tests/wpt/metadata/FileAPI/idlharness.worker.js.ini6
-rw-r--r--tests/wpt/metadata/XMLHttpRequest/interfaces.html.ini14
-rw-r--r--tests/wpt/metadata/dom/interfaces.html.ini33
-rw-r--r--tests/wpt/metadata/html/dom/interfaces.html.ini240
-rw-r--r--tests/wpt/metadata/webstorage/idlharness.html.ini3
-rw-r--r--tests/wpt/metadata/workers/interfaces.worker.js.ini6
15 files changed, 521 insertions, 732 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 24b034ad4cb..82fcc4581d5 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -276,34 +276,6 @@ class CGThing():
raise NotImplementedError # Override me!
-class CGNativePropertyHooks(CGThing):
- """
- Generate a NativePropertyHooks for a given descriptor
- """
- def __init__(self, descriptor, properties):
- CGThing.__init__(self)
- self.descriptor = descriptor
- self.properties = properties
-
- def define(self):
- parent = self.descriptor.interface.parent
- if parent:
- parentHooks = ("Some(&::dom::bindings::codegen::Bindings::%sBinding::sNativePropertyHooks)"
- % parent.identifier.name)
- else:
- parentHooks = "None"
-
- substitutions = {
- "parentHooks": parentHooks
- }
-
- return string.Template(
- "pub static sNativePropertyHooks: NativePropertyHooks = NativePropertyHooks {\n"
- " native_properties: &sNativeProperties,\n"
- " proto_hooks: ${parentHooks},\n"
- "};\n").substitute(substitutions)
-
-
class CGMethodCall(CGThing):
"""
A class to generate selection of a method signature from a set of
@@ -1750,17 +1722,16 @@ def DOMClassTypeId(desc):
def DOMClass(descriptor):
protoList = ['PrototypeList::ID::' + proto for proto in descriptor.prototypeChain]
- # Pad out the list to the right length with ID::Count so we
- # guarantee that all the lists are the same length. id::Count
+ # Pad out the list to the right length with ID::Last so we
+ # guarantee that all the lists are the same length. ID::Last
# is never the ID of any prototype, so it's safe to use as
# padding.
- protoList.extend(['PrototypeList::ID::Count'] * (descriptor.config.maxProtoChainLength - len(protoList)))
+ protoList.extend(['PrototypeList::ID::Last'] * (descriptor.config.maxProtoChainLength - len(protoList)))
prototypeChainString = ', '.join(protoList)
heapSizeOf = 'heap_size_of_raw_self_and_children::<%s>' % descriptor.interface.identifier.name
return """\
DOMClass {
interface_chain: [ %s ],
- native_hooks: &sNativePropertyHooks,
type_id: %s,
heap_size_of: %s as unsafe fn(_) -> _,
}""" % (prototypeChainString, DOMClassTypeId(descriptor), heapSizeOf)
@@ -1839,6 +1810,7 @@ static Class: DOMJSClass = DOMJSClass {
getElements: None,
enumerate: None,
thisObject: %s,
+ funToString: None,
},
},
dom_class: %s
@@ -1882,40 +1854,32 @@ static PrototypeClass: JSClass = JSClass {
hasInstance: None,
construct: None,
trace: None,
- reserved: [0 as *mut libc::c_void; 25]
+ reserved: [0 as *mut libc::c_void; 26]
};
""" % {'name': name, 'slotCount': slotCount}
class CGInterfaceObjectJSClass(CGThing):
def __init__(self, descriptor):
+ assert descriptor.interface.hasInterfaceObject() and not descriptor.interface.isCallback()
CGThing.__init__(self)
self.descriptor = descriptor
def define(self):
- if True:
- return ""
- ctorname = "0 as *const u8" if not self.descriptor.interface.ctor() else CONSTRUCT_HOOK_NAME
- hasinstance = HASINSTANCE_HOOK_NAME
+ if self.descriptor.interface.ctor():
+ constructor = CONSTRUCT_HOOK_NAME
+ else:
+ constructor = "throwing_constructor"
+ args = {
+ "constructor": constructor,
+ "hasInstance": HASINSTANCE_HOOK_NAME,
+ "name": self.descriptor.interface.identifier.name,
+ }
return """\
-const InterfaceObjectClass: JSClass = {
- %s, 0,
- JS_PropertyStub,
- JS_PropertyStub,
- JS_PropertyStub,
- JS_StrictPropertyStub,
- JS_EnumerateStub,
- JS_ResolveStub,
- JS_ConvertStub,
- 0 as *const u8,
- 0 as *const u8,
- %s,
- %s,
- %s,
- 0 as *const u8,
- JSCLASS_NO_INTERNAL_MEMBERS
-};
-""" % (str_to_const_array("Function"), ctorname, hasinstance, ctorname)
+static InterfaceObjectClass: NonCallbackInterfaceObjectClass =
+ NonCallbackInterfaceObjectClass::new(%(constructor)s, %(hasInstance)s,
+ fun_to_string);
+""" % args
class CGList(CGThing):
@@ -2312,8 +2276,8 @@ class CGIDLInterface(CGThing):
name = self.descriptor.name
if (interface.getUserData("hasConcreteDescendant", False) or
interface.getUserData("hasProxyDescendant", False)):
- depth = len(self.descriptor.prototypeChain)
- check = "class.interface_chain[%s] == PrototypeList::ID::%s" % (depth - 1, name)
+ depth = self.descriptor.prototypeDepth
+ check = "class.interface_chain[%s] == PrototypeList::ID::%s" % (depth, name)
elif self.descriptor.proxy:
check = "class as *const _ == &Class as *const _"
else:
@@ -2384,30 +2348,6 @@ class PropertyArrays():
return define
-class CGNativeProperties(CGThing):
- def __init__(self, descriptor, properties):
- CGThing.__init__(self)
- self.properties = properties
-
- def define(self):
- def getField(array):
- propertyArray = getattr(self.properties, array)
- if propertyArray.length() > 0:
- value = "Some(%s)" % propertyArray.variableName()
- else:
- value = "None"
-
- return CGGeneric(string.Template('${name}: ${value},').substitute({
- 'name': array,
- 'value': value,
- }))
-
- nativeProps = CGList([getField(array) for array in self.properties.arrayNames()], '\n')
- return CGWrapper(CGIndenter(nativeProps),
- pre="static sNativeProperties: NativeProperties = NativeProperties {\n",
- post="\n};\n").define()
-
-
class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
"""
Generate the CreateInterfaceObjects method for an interface descriptor.
@@ -2415,62 +2355,113 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
properties should be a PropertyArrays instance.
"""
def __init__(self, descriptor, properties):
- args = [Argument('*mut JSContext', 'cx'), Argument('HandleObject', 'global'),
- Argument('HandleObject', 'receiver'),
- Argument('MutableHandleObject', 'rval')]
- CGAbstractMethod.__init__(self, descriptor, 'CreateInterfaceObjects', 'void', args)
+ args = [Argument('*mut JSContext', 'cx')]
+ if not descriptor.interface.isCallback():
+ args += [Argument('HandleObject', 'global'),
+ Argument('*mut ProtoOrIfaceArray', 'cache')]
+ args.append(Argument('HandleObject', 'receiver'))
+ CGAbstractMethod.__init__(self, descriptor, 'CreateInterfaceObjects', 'void', args,
+ unsafe=True)
self.properties = properties
def definition_body(self):
+ name = self.descriptor.interface.identifier.name
+ if self.descriptor.interface.isCallback():
+ assert not self.descriptor.interface.ctor() and self.descriptor.interface.hasConstants()
+ return CGGeneric("""\
+create_callback_interface_object(cx, receiver, sConstants, %s);""" % str_to_const_array(name))
+
protoChain = self.descriptor.prototypeChain
if len(protoChain) == 1:
- self.unsafe = True
- getParentProto = "parent_proto.ptr = JS_GetObjectPrototype(cx, global)"
+ getPrototypeProto = "prototype_proto.ptr = JS_GetObjectPrototype(cx, global)"
else:
- parentProtoName = self.descriptor.prototypeChain[-2]
- getParentProto = ("%s::GetProtoObject(cx, global, receiver, parent_proto.handle_mut())" %
- toBindingNamespace(parentProtoName))
-
- getParentProto = ("let mut parent_proto = RootedObject::new(cx, ptr::null_mut());\n"
- "%s;\n"
- "assert!(!parent_proto.ptr.is_null());\n") % getParentProto
-
- if self.descriptor.interface.isCallback():
- protoClass = "None"
- else:
- protoClass = "Some(&PrototypeClass)"
+ getPrototypeProto = ("%s::GetProtoObject(cx, global, receiver, prototype_proto.handle_mut())" %
+ toBindingNamespace(self.descriptor.prototypeChain[-2]))
+
+ code = [CGGeneric("""\
+let mut prototype_proto = RootedObject::new(cx, ptr::null_mut());
+%s;
+assert!(!prototype_proto.ptr.is_null());""" % getPrototypeProto)]
+
+ properties = {"id": name}
+ for arrayName in self.properties.arrayNames():
+ array = getattr(self.properties, arrayName)
+ if arrayName == "consts":
+ if array.length():
+ properties[arrayName] = array.variableName()
+ else:
+ properties[arrayName] = "&[]"
+ elif array.length():
+ properties[arrayName] = "Some(%s)" % array.variableName()
+ else:
+ properties[arrayName] = "None"
+
+ code.append(CGGeneric("""
+let mut prototype = RootedObject::new(cx, ptr::null_mut());
+create_interface_prototype_object(cx,
+ prototype_proto.handle(),
+ &PrototypeClass,
+ %(methods)s,
+ %(attrs)s,
+ %(consts)s,
+ prototype.handle_mut());
+assert!(!prototype.ptr.is_null());
+(*cache)[PrototypeList::ID::%(id)s as usize] = prototype.ptr;
+if <*mut JSObject>::needs_post_barrier(prototype.ptr) {
+ <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::%(id)s as isize));
+}""" % properties))
if self.descriptor.interface.hasInterfaceObject():
+ properties["name"] = str_to_const_array(name)
if self.descriptor.interface.ctor():
- constructHook = CONSTRUCT_HOOK_NAME
- constructArgs = methodLength(self.descriptor.interface.ctor())
+ properties["constructor"] = CONSTRUCT_HOOK_NAME
+ properties["length"] = methodLength(self.descriptor.interface.ctor())
else:
- constructHook = "throwing_constructor"
- constructArgs = 0
-
- constructor = 'Some((%s as NonNullJSNative, "%s", %d))' % (
- constructHook, self.descriptor.interface.identifier.name,
- constructArgs)
- else:
- constructor = 'None'
-
- call = """\
-do_create_interface_objects(cx, receiver, parent_proto.handle(),
- %s, %s,
- &named_constructors,
- &sNativeProperties, rval);""" % (protoClass, constructor)
-
- createArray = """\
-let named_constructors: [(NonNullJSNative, &'static str, u32); %d] = [
-""" % len(self.descriptor.interface.namedConstructors)
- for ctor in self.descriptor.interface.namedConstructors:
- constructHook = CONSTRUCT_HOOK_NAME + "_" + ctor.identifier.name
- constructArgs = methodLength(ctor)
- constructor = '(%s as NonNullJSNative, "%s", %d)' % (
- constructHook, ctor.identifier.name, constructArgs)
- createArray += constructor
- createArray += ","
- createArray += "];"
+ properties["constructor"] = "throwing_constructor"
+ properties["length"] = 0
+ if self.descriptor.interface.parent:
+ parentName = toBindingNamespace(self.descriptor.getParentName())
+ code.append(CGGeneric("""
+let mut interface_proto = RootedObject::new(cx, ptr::null_mut());
+%s::GetConstructorObject(cx, global, receiver, interface_proto.handle_mut());""" % parentName))
+ else:
+ code.append(CGGeneric("""
+let interface_proto = RootedObject::new(cx, JS_GetFunctionPrototype(cx, global));"""))
+ code.append(CGGeneric("""\
+assert!(!interface_proto.ptr.is_null());
+
+let mut interface = RootedObject::new(cx, ptr::null_mut());
+create_noncallback_interface_object(cx,
+ receiver,
+ interface_proto.handle(),
+ &InterfaceObjectClass,
+ %(static_methods)s,
+ %(static_attrs)s,
+ %(consts)s,
+ prototype.handle(),
+ %(name)s,
+ %(length)s,
+ interface.handle_mut());
+assert!(!interface.ptr.is_null());""" % properties))
+ if self.descriptor.hasDescendants():
+ code.append(CGGeneric("""\
+(*cache)[PrototypeList::Constructor::%(id)s as usize] = interface.ptr;
+if <*mut JSObject>::needs_post_barrier(prototype.ptr) {
+ <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::Constructor::%(id)s as isize));
+}""" % properties))
+
+ constructors = self.descriptor.interface.namedConstructors
+ if constructors:
+ decl = "let named_constructors: [(NonNullJSNative, &'static [u8], u32); %d]" % len(constructors)
+ specs = []
+ for constructor in constructors:
+ hook = CONSTRUCT_HOOK_NAME + "_" + constructor.identifier.name
+ name = str_to_const_array(constructor.identifier.name)
+ length = methodLength(constructor)
+ specs.append(CGGeneric("(%s as NonNullJSNative, %s, %d)" % (hook, name, length)))
+ values = CGIndenter(CGList(specs, "\n"), 4)
+ code.append(CGWrapper(values, pre="%s = [\n" % decl, post="\n];"))
+ code.append(CGGeneric("create_named_constructors(cx, receiver, &named_constructors, prototype.handle());"))
if self.descriptor.hasUnforgeableMembers:
# We want to use the same JSClass and prototype as the object we'll
@@ -2486,41 +2477,22 @@ let named_constructors: [(NonNullJSNative, &'static str, u32); %d] = [
# the prototype.
if self.descriptor.proxy or self.descriptor.isGlobal():
holderClass = "ptr::null()"
- holderProto = "ptr::null_mut()"
+ holderProto = "HandleObject::null()"
else:
holderClass = "&Class.base as *const js::jsapi::Class as *const JSClass"
- holderProto = "rval.get()"
- # JS_NewObjectWithoutMetadata() is unsafe.
- self.unsafe = True
- createUnforgeableHolder = CGGeneric("""
+ holderProto = "prototype.handle()"
+ code.append(CGGeneric("""
let mut unforgeable_holder = RootedObject::new(cx, ptr::null_mut());
-{
- let holder_class = %(holderClass)s;
- let holder_proto = RootedObject::new(cx, %(holderProto)s);
- unforgeable_holder.handle_mut().set(
- JS_NewObjectWithoutMetadata(cx, holder_class, holder_proto.handle()));
- assert!(!unforgeable_holder.ptr.is_null());
-}""" % {'holderClass': holderClass, 'holderProto': holderProto})
- defineUnforgeables = InitUnforgeablePropertiesOnHolder(self.descriptor,
- self.properties)
- createUnforgeableHolder = CGList(
- [createUnforgeableHolder, defineUnforgeables], "\n")
-
- installUnforgeableHolder = CGGeneric("""\
-JS_SetReservedSlot(rval.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT,
- ObjectValue(&*unforgeable_holder.ptr))""")
-
- unforgeableHolderSetup = CGList(
- [createUnforgeableHolder, installUnforgeableHolder], "\n")
- else:
- unforgeableHolderSetup = None
+unforgeable_holder.handle_mut().set(
+ JS_NewObjectWithoutMetadata(cx, %(holderClass)s, %(holderProto)s));
+assert!(!unforgeable_holder.ptr.is_null());
+""" % {'holderClass': holderClass, 'holderProto': holderProto}))
+ code.append(InitUnforgeablePropertiesOnHolder(self.descriptor, self.properties))
+ code.append(CGGeneric("""\
+JS_SetReservedSlot(prototype.ptr, DOM_PROTO_UNFORGEABLE_HOLDER_SLOT,
+ ObjectValue(&*unforgeable_holder.ptr))"""))
- return CGList([
- CGGeneric(getParentProto),
- CGGeneric(createArray),
- CGGeneric(call % self.properties.variableNames()),
- unforgeableHolderSetup,
- ], "\n")
+ return CGList(code, "\n")
class CGGetPerInterfaceObject(CGAbstractMethod):
@@ -2534,7 +2506,7 @@ class CGGetPerInterfaceObject(CGAbstractMethod):
Argument('MutableHandleObject', 'rval')]
CGAbstractMethod.__init__(self, descriptor, name,
'void', args, pub=pub, unsafe=True)
- self.id = idPrefix + "ID::" + self.descriptor.name
+ self.id = idPrefix + "::" + self.descriptor.name
def definition_body(self):
return CGGeneric("""
@@ -2549,18 +2521,15 @@ 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)[%s as usize]);
+rval.set((*proto_or_iface_array)[%(id)s as usize]);
if !rval.get().is_null() {
return;
}
-CreateInterfaceObjects(cx, global, receiver, rval);
+CreateInterfaceObjects(cx, global, proto_or_iface_array, receiver);
+rval.set((*proto_or_iface_array)[%(id)s as usize]);
assert!(!rval.get().is_null());
-(*proto_or_iface_array)[%s as usize] = rval.get();
-if <*mut JSObject>::needs_post_barrier(rval.get()) {
- <*mut JSObject>::post_barrier((*proto_or_iface_array).as_mut_ptr().offset(%s as isize))
-}
-""" % (self.id, self.id, self.id))
+""" % {"id": self.id})
class CGGetProtoObjectMethod(CGGetPerInterfaceObject):
@@ -2569,7 +2538,7 @@ class CGGetProtoObjectMethod(CGGetPerInterfaceObject):
"""
def __init__(self, descriptor):
CGGetPerInterfaceObject.__init__(self, descriptor, "GetProtoObject",
- "PrototypeList::", pub=descriptor.hasDescendants())
+ "PrototypeList::ID", pub=descriptor.hasDescendants())
def definition_body(self):
return CGList([
@@ -2586,7 +2555,8 @@ class CGGetConstructorObjectMethod(CGGetPerInterfaceObject):
"""
def __init__(self, descriptor):
CGGetPerInterfaceObject.__init__(self, descriptor, "GetConstructorObject",
- "constructors::", pub=descriptor.hasDescendants())
+ "PrototypeList::Constructor",
+ pub=descriptor.hasDescendants())
def definition_body(self):
return CGList([
@@ -2674,10 +2644,7 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
def definition_body(self):
if self.descriptor.interface.isCallback():
- code = """\
-let mut obj = RootedObject::new(cx, ptr::null_mut());
-CreateInterfaceObjects(cx, global, global, obj.handle_mut());
-"""
+ code = "CreateInterfaceObjects(cx, global);"
else:
code = """\
let mut proto = RootedObject::new(cx, ptr::null_mut());
@@ -4738,6 +4705,44 @@ let args = CallArgs::from_vp(vp, argc);
return CGList([preamble, callGenerator])
+class CGClassHasInstanceHook(CGAbstractExternMethod):
+ def __init__(self, descriptor):
+ args = [Argument('*mut JSContext', 'cx'),
+ Argument('HandleObject', 'obj'),
+ Argument('MutableHandleValue', 'value'),
+ Argument('*mut bool', 'rval')]
+ assert descriptor.interface.hasInterfaceObject() and not descriptor.interface.isCallback()
+ CGAbstractExternMethod.__init__(self, descriptor, HASINSTANCE_HOOK_NAME,
+ 'bool', args)
+
+ def definition_body(self):
+ id = "PrototypeList::ID::%s" % self.descriptor.interface.identifier.name
+ return CGGeneric("""\
+match has_instance(cx, obj, value.handle(), %(id)s, %(index)s) {
+ Ok(result) => {
+ *rval = result;
+ true
+ }
+ Err(()) => false,
+}
+""" % {"id": id, "index": self.descriptor.prototypeDepth})
+
+
+class CGClassFunToStringHook(CGAbstractExternMethod):
+ """
+ A hook to convert functions to strings.
+ """
+ def __init__(self, descriptor):
+ args = [Argument('*mut JSContext', 'cx'), Argument('HandleObject', '_obj'),
+ Argument('u32', '_indent')]
+ CGAbstractExternMethod.__init__(self, descriptor, "fun_to_string", '*mut JSString', args)
+
+ def definition_body(self):
+ name = self.descriptor.interface.identifier.name
+ string = str_to_const_array("function %s() {\\n [native code]\\n}" % name)
+ return CGGeneric("JS_NewStringCopyZ(cx, %s as *const _ as *const libc::c_char)" % string)
+
+
class CGClassFinalizeHook(CGAbstractClassHook):
"""
A hook for finalize, used to release our native object.
@@ -4858,10 +4863,8 @@ class CGDescriptor(CGThing):
cgThings = []
if not descriptor.interface.isCallback():
cgThings.append(CGGetProtoObjectMethod(descriptor))
- if descriptor.interface.hasInterfaceObject():
- # https://github.com/mozilla/servo/issues/2665
- # cgThings.append(CGGetConstructorObjectMethod(descriptor))
- pass
+ if descriptor.interface.hasInterfaceObject() and descriptor.hasDescendants():
+ cgThings.append(CGGetConstructorObjectMethod(descriptor))
for m in descriptor.interface.members:
if (m.isMethod() and
@@ -4905,15 +4908,16 @@ class CGDescriptor(CGThing):
cgThings.append(CGClassConstructHook(descriptor))
for ctor in descriptor.interface.namedConstructors:
cgThings.append(CGClassConstructHook(descriptor, ctor))
- cgThings.append(CGInterfaceObjectJSClass(descriptor))
+ if not descriptor.interface.isCallback():
+ cgThings.append(CGInterfaceObjectJSClass(descriptor))
+ cgThings.append(CGClassHasInstanceHook(descriptor))
+ cgThings.append(CGClassFunToStringHook(descriptor))
if not descriptor.interface.isCallback():
cgThings.append(CGPrototypeJSClass(descriptor))
properties = PropertyArrays(descriptor)
cgThings.append(CGGeneric(str(properties)))
- cgThings.append(CGNativeProperties(descriptor, properties))
- cgThings.append(CGNativePropertyHooks(descriptor, properties))
cgThings.append(CGCreateInterfaceObjectsMethod(descriptor, properties))
cgThings.append(CGNamespace.build([descriptor.name + "Constants"],
@@ -4973,22 +4977,12 @@ class CGDescriptor(CGThing):
class CGNonNamespacedEnum(CGThing):
- def __init__(self, enumName, names, values, comment="", deriving="", repr=""):
-
- if not values:
- values = []
-
- # Account for explicit enum values.
- entries = []
- for i in range(0, len(names)):
- if len(values) > i and values[i] is not None:
- entry = "%s = %s" % (names[i], values[i])
- else:
- entry = names[i]
- entries.append(entry)
+ def __init__(self, enumName, names, first, comment="", deriving="", repr=""):
+ # Account for first value
+ entries = ["%s = %s" % (names[0], first)] + names[1:]
- # Append a Count.
- entries.append('Count = ' + str(len(entries)))
+ # Append a Last.
+ entries.append('Last = ' + str(first + len(entries)))
# Indent.
entries = [' ' + e for e in entries]
@@ -5301,16 +5295,16 @@ class CGBindingRoot(CGThing):
'js::jsapi::{HandleId, HandleObject, HandleValue, HandleValueArray}',
'js::jsapi::{INTERNED_STRING_TO_JSID, IsCallable, JS_CallFunctionValue}',
'js::jsapi::{JS_ComputeThis, JS_CopyPropertiesFrom, JS_ForwardGetPropertyTo}',
- 'js::jsapi::{JS_GetClass, JS_GetGlobalForObject, JS_GetObjectPrototype}',
- 'js::jsapi::{JS_GetProperty, JS_GetPropertyById, JS_GetPropertyDescriptorById}',
- 'js::jsapi::{JS_GetReservedSlot, JS_HasProperty, JS_HasPropertyById}',
- 'js::jsapi::{JS_InitializePropertiesFromCompatibleNativeObject, JS_InternString}',
- 'js::jsapi::{JS_IsExceptionPending, JS_NewObject, JS_NewObjectWithGivenProto}',
- 'js::jsapi::{JS_NewObjectWithoutMetadata, JS_SetProperty, JS_SetPrototype}',
- 'js::jsapi::{JS_SetReservedSlot, JS_WrapValue, JSAutoCompartment, JSAutoRequest}',
- 'js::jsapi::{JSContext, JSClass, JSFreeOp, JSFunctionSpec, JSJitGetterCallArgs}',
- 'js::jsapi::{JSJitInfo, JSJitMethodCallArgs, JSJitSetterCallArgs, JSNative}',
- 'js::jsapi::{JSObject, JSNativeWrapper, JSPropertyDescriptor, JSPropertySpec}',
+ 'js::jsapi::{JS_GetClass, JS_GetFunctionPrototype, JS_GetGlobalForObject}',
+ '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_InternString, JS_IsExceptionPending, JS_NewObject, JS_NewObjectWithGivenProto}',
+ 'js::jsapi::{JS_NewObjectWithoutMetadata, JS_NewStringCopyZ, JS_SetProperty}',
+ 'js::jsapi::{JS_SetPrototype, JS_SetReservedSlot, JS_WrapValue, JSAutoCompartment}',
+ 'js::jsapi::{JSAutoRequest, JSContext, JSClass, JSFreeOp, JSFunctionSpec}',
+ 'js::jsapi::{JSJitGetterCallArgs, JSJitInfo, JSJitMethodCallArgs, JSJitSetterCallArgs}',
+ 'js::jsapi::{JSNative, JSObject, JSNativeWrapper, JSPropertyDescriptor, JSPropertySpec}',
'js::jsapi::{JSString, JSTracer, JSType, JSTypedMethodJitInfo, JSValueType}',
'js::jsapi::{ObjectOpResult, OpType, MutableHandle, MutableHandleObject}',
'js::jsapi::{MutableHandleValue, RootedId, RootedObject, RootedString}',
@@ -5326,14 +5320,16 @@ class CGBindingRoot(CGThing):
'js::rust::{GCMethods, define_methods, define_properties}',
'dom::bindings',
'dom::bindings::global::{GlobalRef, global_root_from_object, global_root_from_reflector}',
+ 'dom::bindings::interface::{NonCallbackInterfaceObjectClass, create_callback_interface_object}',
+ 'dom::bindings::interface::{create_interface_prototype_object, create_named_constructors}',
+ 'dom::bindings::interface::{create_noncallback_interface_object, has_instance}',
'dom::bindings::js::{JS, Root, RootedReference}',
'dom::bindings::js::{OptionalRootedReference}',
'dom::bindings::reflector::{Reflectable}',
'dom::bindings::utils::{ConstantSpec, DOMClass, DOMJSClass}',
'dom::bindings::utils::{DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, JSCLASS_DOM_GLOBAL}',
- 'dom::bindings::utils::{NativeProperties, NativePropertyHooks, NonNullJSNative}',
- 'dom::bindings::utils::{create_dom_global, do_create_interface_objects, finalize_global}',
- 'dom::bindings::utils::{find_enum_string_index, generic_getter}',
+ 'dom::bindings::utils::{NonNullJSNative, ProtoOrIfaceArray, create_dom_global}',
+ 'dom::bindings::utils::{finalize_global, find_enum_string_index, generic_getter}',
'dom::bindings::utils::{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}',
@@ -5985,23 +5981,28 @@ class GlobalGenRoots():
@staticmethod
def PrototypeList(config):
# Prototype ID enum.
- protos = [d.name for d in config.getDescriptors(isCallback=False)]
+ interfaces = config.getDescriptors(isCallback=False)
+ protos = [d.name for d in interfaces]
+ constructors = [d.name for d in interfaces if d.hasDescendants()]
proxies = [d.name for d in config.getDescriptors(proxy=True)]
return CGList([
CGGeneric(AUTOGENERATED_WARNING_COMMENT),
+ CGGeneric("pub const PROTO_OR_IFACE_LENGTH: usize = %d;\n" % (len(protos) + len(constructors))),
CGGeneric("pub const MAX_PROTO_CHAIN_LENGTH: usize = %d;\n\n" % config.maxProtoChainLength),
- CGNonNamespacedEnum('ID', protos, [0], deriving="PartialEq, Copy, Clone", repr="u16"),
+ CGNonNamespacedEnum('ID', protos, 0, deriving="PartialEq, Copy, Clone", repr="u16"),
+ CGNonNamespacedEnum('Constructor', constructors, len(protos),
+ deriving="PartialEq, Copy, Clone", repr="u16"),
CGWrapper(CGIndenter(CGList([CGGeneric('"' + name + '"') for name in protos],
",\n"),
indentLevel=4),
pre="static INTERFACES: [&'static str; %d] = [\n" % len(protos),
post="\n];\n\n"),
CGGeneric("pub fn proto_id_to_name(proto_id: u16) -> &'static str {\n"
- " debug_assert!(proto_id < ID::Count as u16);\n"
+ " debug_assert!(proto_id < ID::Last as u16);\n"
" INTERFACES[proto_id as usize]\n"
"}\n\n"),
- CGNonNamespacedEnum('Proxies', proxies, [0], deriving="PartialEq, Copy, Clone"),
+ CGNonNamespacedEnum('Proxies', proxies, 0, deriving="PartialEq, Copy, Clone"),
])
@staticmethod
diff --git a/components/script/dom/bindings/codegen/Configuration.py b/components/script/dom/bindings/codegen/Configuration.py
index 2106ff4adee..ac78e52c071 100644
--- a/components/script/dom/bindings/codegen/Configuration.py
+++ b/components/script/dom/bindings/codegen/Configuration.py
@@ -296,6 +296,7 @@ class Descriptor(DescriptorProvider):
while parent:
self.prototypeChain.insert(0, parent.identifier.name)
parent = parent.parent
+ self.prototypeDepth = len(self.prototypeChain) - 1
config.maxProtoChainLength = max(config.maxProtoChainLength,
len(self.prototypeChain))
diff --git a/components/script/dom/bindings/interface.rs b/components/script/dom/bindings/interface.rs
new file mode 100644
index 00000000000..96f4d7c470a
--- /dev/null
+++ b/components/script/dom/bindings/interface.rs
@@ -0,0 +1,284 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+//! Machinery to initialise interface prototype objects and interface objects.
+
+use dom::bindings::codegen::PrototypeList;
+use dom::bindings::conversions::get_dom_class;
+use dom::bindings::utils::{ConstantSpec, NonNullJSNative, define_constants};
+use js::glue::UncheckedUnwrapObject;
+use js::jsapi::{Class, ClassExtension, ClassSpec, HandleObject, HandleValue, JSClass};
+use js::jsapi::{JSContext, JSFunctionSpec, JSPropertySpec, JSString, JS_DefineProperty1};
+use js::jsapi::{JS_DefineProperty2, JS_DefineProperty4, JS_GetFunctionObject};
+use js::jsapi::{JS_GetPrototype, JS_InternString, JS_LinkConstructorAndPrototype};
+use js::jsapi::{JS_NewFunction, JS_NewObject, JS_NewObjectWithUniqueType};
+use js::jsapi::{MutableHandleObject, MutableHandleValue, ObjectOps, RootedObject};
+use js::jsapi::{RootedString, Value};
+use js::rust::{define_methods, define_properties};
+use js::{JSFUN_CONSTRUCTOR, JSPROP_PERMANENT, JSPROP_READONLY};
+use libc;
+use std::ptr;
+
+/// A constructor class hook.
+pub type ConstructorClassHook =
+ unsafe extern "C" fn(cx: *mut JSContext, argc: u32, vp: *mut Value) -> bool;
+
+/// A has_instance class hook.
+pub type HasInstanceClassHook =
+ unsafe extern "C" fn(cx: *mut JSContext,
+ obj: HandleObject,
+ vp: MutableHandleValue,
+ bp: *mut bool)
+ -> bool;
+
+/// A fun_to_string class hook.
+pub type FunToStringHook =
+ unsafe extern "C" fn(cx: *mut JSContext,
+ obj: HandleObject,
+ indent: u32)
+ -> *mut JSString;
+
+/// The class of a non-callback interface object.
+#[derive(Copy, Clone)]
+pub struct NonCallbackInterfaceObjectClass {
+ /// The SpiderMonkey Class structure.
+ pub class: Class,
+}
+unsafe impl Sync for NonCallbackInterfaceObjectClass {}
+
+impl NonCallbackInterfaceObjectClass {
+ /// Create a new `NonCallbackInterfaceObjectClass` structure.
+ pub const fn new(
+ constructor: ConstructorClassHook,
+ has_instance: HasInstanceClassHook,
+ fun_to_string: FunToStringHook)
+ -> NonCallbackInterfaceObjectClass {
+ NonCallbackInterfaceObjectClass {
+ class: Class {
+ name: b"Function\0" as *const _ as *const libc::c_char,
+ flags: 0,
+ addProperty: None,
+ delProperty: None,
+ getProperty: None,
+ setProperty: None,
+ enumerate: None,
+ resolve: None,
+ convert: None,
+ finalize: None,
+ call: Some(constructor),
+ hasInstance: Some(has_instance),
+ construct: Some(constructor),
+ trace: None,
+ spec: ClassSpec {
+ createConstructor: None,
+ createPrototype: None,
+ constructorFunctions: ptr::null(),
+ constructorProperties: ptr::null(),
+ prototypeFunctions: ptr::null(),
+ prototypeProperties: ptr::null(),
+ finishInit: None,
+ flags: 0,
+ },
+ ext: ClassExtension {
+ outerObject: None,
+ innerObject: None,
+ isWrappedNative: false,
+ weakmapKeyDelegateOp: None,
+ objectMovedOp: None,
+ },
+ ops: 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,
+ funToString: Some(fun_to_string),
+ }
+ },
+ }
+ }
+}
+
+/// Create and define the interface object of a callback interface.
+pub unsafe fn create_callback_interface_object(
+ cx: *mut JSContext,
+ receiver: HandleObject,
+ constants: &'static [ConstantSpec],
+ name: &'static [u8]) {
+ assert!(!constants.is_empty());
+ let interface_object = RootedObject::new(cx, JS_NewObject(cx, ptr::null()));
+ assert!(!interface_object.ptr.is_null());
+ define_constants(cx, interface_object.handle(), constants);
+ define_name(cx, interface_object.handle(), name);
+ define_on_global_object(cx, receiver, name, interface_object.handle());
+}
+
+/// Create the interface prototype object of a non-callback interface.
+pub unsafe fn create_interface_prototype_object(
+ cx: *mut JSContext,
+ proto: HandleObject,
+ class: &'static JSClass,
+ regular_methods: Option<&'static [JSFunctionSpec]>,
+ regular_properties: Option<&'static [JSPropertySpec]>,
+ constants: &'static [ConstantSpec],
+ rval: MutableHandleObject) {
+ create_object(cx, proto, class, regular_methods, regular_properties, constants, rval);
+}
+
+/// Create and define the interface object of a non-callback interface.
+pub unsafe fn create_noncallback_interface_object(
+ cx: *mut JSContext,
+ receiver: HandleObject,
+ proto: HandleObject,
+ class: &'static NonCallbackInterfaceObjectClass,
+ static_methods: Option<&'static [JSFunctionSpec]>,
+ static_properties: Option<&'static [JSPropertySpec]>,
+ constants: &'static [ConstantSpec],
+ interface_prototype_object: HandleObject,
+ name: &'static [u8],
+ length: u32,
+ rval: MutableHandleObject) {
+ create_object(cx,
+ proto,
+ &*(class as *const _ as *const JSClass),
+ static_methods,
+ static_properties,
+ constants,
+ rval);
+ assert!(JS_LinkConstructorAndPrototype(cx, rval.handle(), interface_prototype_object));
+ define_name(cx, rval.handle(), name);
+ define_length(cx, rval.handle(), length);
+ define_on_global_object(cx, receiver, name, rval.handle());
+}
+
+/// Create and define the named constructors of a non-callback interface.
+pub unsafe fn create_named_constructors(
+ cx: *mut JSContext,
+ receiver: HandleObject,
+ named_constructors: &[(NonNullJSNative, &'static [u8], u32)],
+ interface_prototype_object: HandleObject) {
+ let mut constructor = RootedObject::new(cx, ptr::null_mut());
+
+ for &(native, name, arity) in named_constructors {
+ assert!(*name.last().unwrap() == b'\0');
+
+ let fun = JS_NewFunction(cx,
+ Some(native),
+ arity,
+ JSFUN_CONSTRUCTOR,
+ name.as_ptr() as *const libc::c_char);
+ assert!(!fun.is_null());
+ constructor.ptr = JS_GetFunctionObject(fun);
+ assert!(!constructor.ptr.is_null());
+
+ assert!(JS_DefineProperty1(cx,
+ constructor.handle(),
+ b"prototype\0".as_ptr() as *const libc::c_char,
+ interface_prototype_object,
+ JSPROP_PERMANENT | JSPROP_READONLY,
+ None,
+ None));
+
+ define_on_global_object(cx, receiver, name, constructor.handle());
+ }
+}
+
+/// Return whether a value is an instance of a given prototype.
+/// http://heycam.github.io/webidl/#es-interface-hasinstance
+pub unsafe fn has_instance(
+ cx: *mut JSContext,
+ prototype: HandleObject,
+ value: HandleValue,
+ id: PrototypeList::ID,
+ index: usize)
+ -> Result<bool, ()> {
+ if !value.is_object() {
+ // Step 1.
+ return Ok(false);
+ }
+ let mut value = RootedObject::new(cx, value.to_object());
+
+ // Steps 2-3 only concern callback interface objects.
+
+ if let Ok(dom_class) = get_dom_class(UncheckedUnwrapObject(value.ptr, /* stopAtOuter = */ 0)) {
+ if dom_class.interface_chain[index] == id {
+ // Step 4.
+ return Ok(true);
+ }
+ }
+
+ while JS_GetPrototype(cx, value.handle(), value.handle_mut()) {
+ if value.ptr.is_null() {
+ // Step 5.2.
+ return Ok(false);
+ } else if value.ptr as *const _ == prototype.ptr {
+ // Step 5.3.
+ return Ok(true);
+ }
+ }
+ // JS_GetPrototype threw an exception.
+ Err(())
+}
+
+unsafe fn create_object(
+ cx: *mut JSContext,
+ proto: HandleObject,
+ class: &'static JSClass,
+ methods: Option<&'static [JSFunctionSpec]>,
+ properties: Option<&'static [JSPropertySpec]>,
+ constants: &'static [ConstantSpec],
+ rval: MutableHandleObject) {
+ rval.set(JS_NewObjectWithUniqueType(cx, class, proto));
+ assert!(!rval.ptr.is_null());
+ if let Some(methods) = methods {
+ define_methods(cx, rval.handle(), methods).unwrap();
+ }
+ if let Some(properties) = properties {
+ define_properties(cx, rval.handle(), properties).unwrap();
+ }
+ define_constants(cx, rval.handle(), constants);
+}
+
+unsafe fn define_name(cx: *mut JSContext, obj: HandleObject, name: &'static [u8]) {
+ assert!(*name.last().unwrap() == b'\0');
+ let name =
+ RootedString::new(cx, JS_InternString(cx, name.as_ptr() as *const libc::c_char));
+ assert!(!name.ptr.is_null());
+ assert!(JS_DefineProperty2(cx,
+ obj,
+ b"name\0".as_ptr() as *const libc::c_char,
+ name.handle(),
+ JSPROP_READONLY,
+ None, None));
+}
+
+unsafe fn define_length(cx: *mut JSContext, obj: HandleObject, length: u32) {
+ assert!(JS_DefineProperty4(cx,
+ obj,
+ b"length\0".as_ptr() as *const libc::c_char,
+ length,
+ JSPROP_READONLY,
+ None, None));
+}
+
+unsafe fn define_on_global_object(
+ cx: *mut JSContext,
+ receiver: HandleObject,
+ name: &'static [u8],
+ obj: HandleObject) {
+ assert!(*name.last().unwrap() == b'\0');
+ assert!(JS_DefineProperty1(cx,
+ receiver,
+ name.as_ptr() as *const libc::c_char,
+ obj,
+ 0,
+ None, None));
+}
diff --git a/components/script/dom/bindings/mod.rs b/components/script/dom/bindings/mod.rs
index df5f37ad07f..8bef928034c 100644
--- a/components/script/dom/bindings/mod.rs
+++ b/components/script/dom/bindings/mod.rs
@@ -138,6 +138,7 @@ pub mod conversions;
pub mod error;
pub mod global;
pub mod inheritance;
+pub mod interface;
pub mod js;
pub mod num;
pub mod proxyhandler;
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs
index 46ea2e78aa1..6534d5171cb 100644
--- a/components/script/dom/bindings/utils.rs
+++ b/components/script/dom/bindings/utils.rs
@@ -5,7 +5,7 @@
//! Various utilities to glue JavaScript and the DOM implementation together.
use dom::bindings::codegen::PrototypeList;
-use dom::bindings::codegen::PrototypeList::MAX_PROTO_CHAIN_LENGTH;
+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::{private_from_proto_check, root_from_handleobject};
use dom::bindings::error::throw_invalid_this;
@@ -19,32 +19,19 @@ use js::glue::{CallJitGetterOp, CallJitMethodOp, CallJitSetterOp, IsWrapper};
use js::glue::{GetCrossCompartmentWrapper, WrapperNew};
use js::glue::{RUST_FUNCTION_VALUE_TO_JITINFO, RUST_JSID_IS_INT};
use js::glue::{RUST_JSID_TO_INT, UnwrapObject};
-use js::jsapi::JSAutoCompartment;
-use js::jsapi::JS_DeletePropertyById1;
-use js::jsapi::JS_GetFunctionObject;
-use js::jsapi::JS_IsExceptionPending;
-use js::jsapi::JS_NewObjectWithUniqueType;
-use js::jsapi::JS_ObjectToOuterObject;
-use js::jsapi::{CallArgs, GetGlobalForObjectCrossCompartment, JSJitInfo};
-use js::jsapi::{CompartmentOptions, OnNewGlobalHookOption};
-use js::jsapi::{DOMCallbacks, JSWrapObjectCallbacks};
-use js::jsapi::{HandleId, HandleObject, HandleValue, MutableHandleValue};
-use js::jsapi::{Heap, MutableHandleObject, ObjectOpResult, RootedObject, RootedValue};
-use js::jsapi::{JSClass, JSContext, JSObject, JSTracer};
-use js::jsapi::{JSFunctionSpec, JSPropertySpec};
-use js::jsapi::{JSTraceOp, JS_AlreadyHasOwnProperty, JS_NewFunction};
-use js::jsapi::{JSVersion, JS_FireOnNewGlobalObject};
-use js::jsapi::{JS_DefineProperty, JS_DefineProperty1, JS_ForwardGetPropertyTo};
-use js::jsapi::{JS_GetClass, JS_LinkConstructorAndPrototype};
-use js::jsapi::{JS_GetProperty, JS_HasProperty, JS_SetProperty};
-use js::jsapi::{JS_GetPrototype, JS_HasPropertyById};
-use js::jsapi::{JS_GetReservedSlot, JS_SetReservedSlot};
-use js::jsapi::{JS_InitStandardClasses, JS_NewGlobalObject};
+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_DefineProperty, JS_DeletePropertyById1, JS_FireOnNewGlobalObject};
+use js::jsapi::{JS_ForwardGetPropertyTo, JS_GetClass, JS_GetProperty, JS_GetPrototype};
+use js::jsapi::{JS_GetReservedSlot, JS_HasProperty, JS_HasPropertyById, JS_InitStandardClasses};
+use js::jsapi::{JS_IsExceptionPending, JS_NewGlobalObject, JS_ObjectToOuterObject, JS_SetProperty};
+use js::jsapi::{JS_SetReservedSlot, MutableHandleValue, ObjectOpResult, OnNewGlobalHookOption};
+use js::jsapi::{RootedObject, RootedValue};
use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, NullValue};
use js::jsval::{PrivateValue, UInt32Value, UndefinedValue};
-use js::rust::{GCMethods, ToString, define_methods, define_properties};
-use js::{JSFUN_CONSTRUCTOR, JSPROP_ENUMERATE, JS_CALLEE};
-use js::{JSPROP_PERMANENT, JSPROP_READONLY};
+use js::rust::{GCMethods, ToString};
+use js::{JS_CALLEE, JSPROP_ENUMERATE, JSPROP_PERMANENT, JSPROP_READONLY};
use libc::{self, c_uint};
use std::default::Default;
use std::ffi::CString;
@@ -129,15 +116,6 @@ impl ConstantSpec {
}
}
-/// Helper structure for cross-origin wrappers for DOM binding objects.
-pub struct NativePropertyHooks {
- /// The property arrays for this interface.
- pub native_properties: &'static NativeProperties,
-
- /// The NativePropertyHooks instance for the parent interface, if any.
- pub proto_hooks: Option<&'static NativePropertyHooks>,
-}
-
/// The struct that holds inheritance information for DOM object reflectors.
#[derive(Copy, Clone)]
pub struct DOMClass {
@@ -148,9 +126,6 @@ pub struct DOMClass {
/// The type ID of that interface.
pub type_id: TopTypeId,
- /// The NativePropertyHooks for the interface associated with this class.
- pub native_hooks: &'static NativePropertyHooks,
-
/// The HeapSizeOf function wrapper for that interface.
pub heap_size_of: unsafe fn(*const libc::c_void) -> usize,
}
@@ -180,153 +155,13 @@ pub fn get_proto_or_iface_array(global: *mut JSObject) -> *mut ProtoOrIfaceArray
}
}
-/// Contains references to lists of methods, attributes, and constants for a
-/// given interface.
-pub struct NativeProperties {
- /// Instance methods for the interface.
- pub methods: Option<&'static [JSFunctionSpec]>,
- /// Unforgeable instance methods for the interface.
- pub unforgeable_methods: Option<&'static [JSFunctionSpec]>,
- /// Instance attributes for the interface.
- pub attrs: Option<&'static [JSPropertySpec]>,
- /// Unforgeable instance attributes for the interface.
- pub unforgeable_attrs: Option<&'static [JSPropertySpec]>,
- /// Constants for the interface.
- pub consts: Option<&'static [ConstantSpec]>,
- /// Static methods for the interface.
- pub static_methods: Option<&'static [JSFunctionSpec]>,
- /// Static attributes for the interface.
- pub static_attrs: Option<&'static [JSPropertySpec]>,
-}
-unsafe impl Sync for NativeProperties {}
-
/// A JSNative that cannot be null.
pub type NonNullJSNative =
unsafe extern "C" fn (arg1: *mut JSContext, arg2: c_uint, arg3: *mut JSVal) -> bool;
-/// Creates the *interface prototype object* (if a `proto_class` is given)
-/// and the *interface object* (if a `constructor` is given).
-/// Fails on JSAPI failure.
-pub fn do_create_interface_objects(cx: *mut JSContext,
- receiver: HandleObject,
- proto_proto: HandleObject,
- proto_class: Option<&'static JSClass>,
- constructor: Option<(NonNullJSNative, &'static str, u32)>,
- named_constructors: &[(NonNullJSNative, &'static str, u32)],
- members: &'static NativeProperties,
- rval: MutableHandleObject) {
- assert!(rval.get().is_null());
- if let Some(proto_class) = proto_class {
- create_interface_prototype_object(cx, proto_proto, proto_class, members, rval);
- }
-
- if let Some((native, name, nargs)) = constructor {
- let s = CString::new(name).unwrap();
- create_interface_object(cx,
- receiver,
- native,
- nargs,
- rval.handle(),
- members,
- s.as_ptr())
- }
-
- for ctor in named_constructors {
- let (cnative, cname, cnargs) = *ctor;
-
- let cs = CString::new(cname).unwrap();
- let constructor = RootedObject::new(cx,
- create_constructor(cx, cnative, cnargs, cs.as_ptr()));
- assert!(!constructor.ptr.is_null());
- unsafe {
- assert!(JS_DefineProperty1(cx,
- constructor.handle(),
- b"prototype\0".as_ptr() as *const libc::c_char,
- rval.handle(),
- JSPROP_PERMANENT | JSPROP_READONLY,
- None,
- None));
- }
- define_constructor(cx, receiver, cs.as_ptr(), constructor.handle());
- }
-
-}
-
-fn create_constructor(cx: *mut JSContext,
- constructor_native: NonNullJSNative,
- ctor_nargs: u32,
- name: *const libc::c_char)
- -> *mut JSObject {
- unsafe {
- let fun = JS_NewFunction(cx,
- Some(constructor_native),
- ctor_nargs,
- JSFUN_CONSTRUCTOR,
- name);
- assert!(!fun.is_null());
-
- let constructor = JS_GetFunctionObject(fun);
- assert!(!constructor.is_null());
-
- constructor
- }
-}
-
-fn define_constructor(cx: *mut JSContext,
- receiver: HandleObject,
- name: *const libc::c_char,
- constructor: HandleObject) {
- unsafe {
- let mut already_defined = false;
- assert!(JS_AlreadyHasOwnProperty(cx, receiver, name, &mut already_defined));
-
- if !already_defined {
- assert!(JS_DefineProperty1(cx, receiver, name, constructor, 0, None, None));
- }
-
- }
-}
-
-/// Creates the *interface object*.
-/// Fails on JSAPI failure.
-fn create_interface_object(cx: *mut JSContext,
- receiver: HandleObject,
- constructor_native: NonNullJSNative,
- ctor_nargs: u32,
- proto: HandleObject,
- members: &'static NativeProperties,
- name: *const libc::c_char) {
- unsafe {
- let constructor = RootedObject::new(cx,
- create_constructor(cx,
- constructor_native,
- ctor_nargs,
- name));
- assert!(!constructor.ptr.is_null());
-
- if let Some(static_methods) = members.static_methods {
- define_methods(cx, constructor.handle(), static_methods).unwrap();
- }
-
- if let Some(static_properties) = members.static_attrs {
- define_properties(cx, constructor.handle(), static_properties).unwrap();
- }
-
- if let Some(constants) = members.consts {
- define_constants(cx, constructor.handle(), constants);
- }
-
- if !proto.get().is_null() {
- assert!(JS_LinkConstructorAndPrototype(cx, constructor.handle(), proto));
- }
-
- define_constructor(cx, receiver, name, constructor.handle());
- }
-}
-
/// Defines constants on `obj`.
/// Fails on JSAPI failure.
-fn define_constants(cx: *mut JSContext, obj: HandleObject, constants: &'static [ConstantSpec]) {
+pub fn define_constants(cx: *mut JSContext, obj: HandleObject, constants: &'static [ConstantSpec]) {
for spec in constants {
let value = RootedValue::new(cx, spec.get_value());
unsafe {
@@ -341,31 +176,6 @@ fn define_constants(cx: *mut JSContext, obj: HandleObject, constants: &'static [
}
}
-/// Creates the *interface prototype object*.
-/// Fails on JSAPI failure.
-fn create_interface_prototype_object(cx: *mut JSContext,
- parent_proto: HandleObject,
- proto_class: &'static JSClass,
- members: &'static NativeProperties,
- rval: MutableHandleObject) {
- unsafe {
- rval.set(JS_NewObjectWithUniqueType(cx, proto_class, parent_proto));
- assert!(!rval.get().is_null());
-
- if let Some(methods) = members.methods {
- define_methods(cx, rval.handle(), methods).unwrap();
- }
-
- if let Some(properties) = members.attrs {
- define_properties(cx, rval.handle(), properties).unwrap();
- }
-
- if let Some(constants) = members.consts {
- define_constants(cx, rval.handle(), constants);
- }
- }
-}
-
/// A throwing constructor, for those interfaces that have neither
/// `NoInterfaceObject` nor `Constructor`.
pub unsafe extern "C" fn throwing_constructor(cx: *mut JSContext,
@@ -376,8 +186,8 @@ pub unsafe extern "C" fn throwing_constructor(cx: *mut JSContext,
false
}
-/// An array of *mut JSObject of size PrototypeList::ID::Count
-pub type ProtoOrIfaceArray = [*mut JSObject; PrototypeList::ID::Count as usize];
+/// An array of *mut JSObject of size PROTO_OR_IFACE_LENGTH.
+pub type ProtoOrIfaceArray = [*mut JSObject; PROTO_OR_IFACE_LENGTH];
/// Gets the property `id` on `proxy`'s prototype. If it exists, `*found` is
/// set to true and `*vp` to the value, otherwise `*found` is set to false.
@@ -574,7 +384,7 @@ pub fn create_dom_global(cx: *mut JSContext,
// avoid getting trace hooks called on a partially initialized object.
JS_SetReservedSlot(obj.ptr, DOM_OBJECT_SLOT, PrivateValue(private));
let proto_array: Box<ProtoOrIfaceArray> =
- box [0 as *mut JSObject; PrototypeList::ID::Count as usize];
+ box [0 as *mut JSObject; PROTO_OR_IFACE_LENGTH];
JS_SetReservedSlot(obj.ptr,
DOM_PROTOTYPE_SLOT,
PrivateValue(Box::into_raw(proto_array) as *const libc::c_void));
@@ -590,7 +400,7 @@ pub fn create_dom_global(cx: *mut JSContext,
pub unsafe fn finalize_global(obj: *mut JSObject) {
let protolist = get_proto_or_iface_array(obj);
let list = (*protolist).as_mut_ptr();
- for idx in 0..(PrototypeList::ID::Count as isize) {
+ for idx in 0..PROTO_OR_IFACE_LENGTH as isize {
let entry = list.offset(idx);
let value = *entry;
if <*mut JSObject>::needs_post_barrier(value) {
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock
index 9fbcfe932ff..8e5f2cf435f 100644
--- a/components/servo/Cargo.lock
+++ b/components/servo/Cargo.lock
@@ -889,7 +889,7 @@ dependencies = [
[[package]]
name = "js"
version = "0.1.1"
-source = "git+https://github.com/servo/rust-mozjs#07523d8b3dd12276eb94a266e83c0b1d77aa4160"
+source = "git+https://github.com/servo/rust-mozjs#4d384eb830d8d53c1268e8ce37135ace21e41721"
dependencies = [
"heapsize 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1110,7 +1110,7 @@ dependencies = [
[[package]]
name = "mozjs_sys"
version = "0.0.0"
-source = "git+https://github.com/servo/mozjs#e89e72f1d69b6a90a7b691fec2e4624e6a375824"
+source = "git+https://github.com/servo/mozjs#9cd5629500dec858956d39c757954782671f3052"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock
index 6bc547973ba..0a327c39b8a 100644
--- a/ports/cef/Cargo.lock
+++ b/ports/cef/Cargo.lock
@@ -847,7 +847,7 @@ dependencies = [
[[package]]
name = "js"
version = "0.1.1"
-source = "git+https://github.com/servo/rust-mozjs#07523d8b3dd12276eb94a266e83c0b1d77aa4160"
+source = "git+https://github.com/servo/rust-mozjs#4d384eb830d8d53c1268e8ce37135ace21e41721"
dependencies = [
"heapsize 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1068,7 +1068,7 @@ dependencies = [
[[package]]
name = "mozjs_sys"
version = "0.0.0"
-source = "git+https://github.com/servo/mozjs#e89e72f1d69b6a90a7b691fec2e4624e6a375824"
+source = "git+https://github.com/servo/mozjs#9cd5629500dec858956d39c757954782671f3052"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock
index 448dc229598..b7056fc08e6 100644
--- a/ports/gonk/Cargo.lock
+++ b/ports/gonk/Cargo.lock
@@ -815,7 +815,7 @@ dependencies = [
[[package]]
name = "js"
version = "0.1.1"
-source = "git+https://github.com/servo/rust-mozjs#07523d8b3dd12276eb94a266e83c0b1d77aa4160"
+source = "git+https://github.com/servo/rust-mozjs#4d384eb830d8d53c1268e8ce37135ace21e41721"
dependencies = [
"heapsize 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1036,7 +1036,7 @@ dependencies = [
[[package]]
name = "mozjs_sys"
version = "0.0.0"
-source = "git+https://github.com/servo/mozjs#e89e72f1d69b6a90a7b691fec2e4624e6a375824"
+source = "git+https://github.com/servo/mozjs#9cd5629500dec858956d39c757954782671f3052"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/tests/wpt/metadata/FileAPI/idlharness.html.ini b/tests/wpt/metadata/FileAPI/idlharness.html.ini
index 1e55a714eab..c91eb848d80 100644
--- a/tests/wpt/metadata/FileAPI/idlharness.html.ini
+++ b/tests/wpt/metadata/FileAPI/idlharness.html.ini
@@ -9,9 +9,6 @@
[URL interface: operation revokeObjectURL(DOMString)]
expected: FAIL
- [File interface: existence and properties of interface object]
- expected: FAIL
-
[File interface object length]
expected: FAIL
@@ -63,9 +60,6 @@
[FileList interface: file_input.files must inherit property "length" with the proper type (1)]
expected: FAIL
- [FileReader interface: existence and properties of interface object]
- expected: FAIL
-
[FileReaderSync interface: existence and properties of interface object]
expected: FAIL
diff --git a/tests/wpt/metadata/FileAPI/idlharness.worker.js.ini b/tests/wpt/metadata/FileAPI/idlharness.worker.js.ini
index 2b429ddbdc5..33363991f7e 100644
--- a/tests/wpt/metadata/FileAPI/idlharness.worker.js.ini
+++ b/tests/wpt/metadata/FileAPI/idlharness.worker.js.ini
@@ -9,9 +9,6 @@
[URL interface: operation revokeObjectURL(DOMString)]
expected: FAIL
- [File interface: existence and properties of interface object]
- expected: FAIL
-
[File interface object length]
expected: FAIL
@@ -48,9 +45,6 @@
[Blob interface: new File(["myFileBits"\], "myFileName") must inherit property "close" with the proper type (4)]
expected: FAIL
- [FileReader interface: existence and properties of interface object]
- expected: FAIL
-
[FileReader interface: operation readAsArrayBuffer(Blob)]
expected: FAIL
diff --git a/tests/wpt/metadata/XMLHttpRequest/interfaces.html.ini b/tests/wpt/metadata/XMLHttpRequest/interfaces.html.ini
deleted file mode 100644
index 48adbf303ae..00000000000
--- a/tests/wpt/metadata/XMLHttpRequest/interfaces.html.ini
+++ /dev/null
@@ -1,14 +0,0 @@
-[interfaces.html]
- type: testharness
- [ProgressEvent interface: existence and properties of interface object]
- expected: FAIL
-
- [XMLHttpRequestEventTarget interface: existence and properties of interface object]
- expected: FAIL
-
- [XMLHttpRequestUpload interface: existence and properties of interface object]
- expected: FAIL
-
- [XMLHttpRequest interface: existence and properties of interface object]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/dom/interfaces.html.ini b/tests/wpt/metadata/dom/interfaces.html.ini
index 7e5e7b17fec..0a7aab7b33b 100644
--- a/tests/wpt/metadata/dom/interfaces.html.ini
+++ b/tests/wpt/metadata/dom/interfaces.html.ini
@@ -1,8 +1,5 @@
[interfaces.html]
type: testharness
- [CustomEvent interface: existence and properties of interface object]
- expected: FAIL
-
[MutationObserver interface: existence and properties of interface object]
expected: FAIL
@@ -63,12 +60,6 @@
[MutationRecord interface: attribute oldValue]
expected: FAIL
- [Node interface: existence and properties of interface object]
- expected: FAIL
-
- [Document interface: existence and properties of interface object]
- expected: FAIL
-
[Document interface: attribute origin]
expected: FAIL
@@ -96,9 +87,6 @@
[Document interface: calling queryAll(DOMString) on xmlDoc with too few arguments must throw TypeError]
expected: FAIL
- [DocumentFragment interface: existence and properties of interface object]
- expected: FAIL
-
[DocumentFragment interface: operation query(DOMString)]
expected: FAIL
@@ -117,12 +105,6 @@
[DocumentFragment interface: calling queryAll(DOMString) on document.createDocumentFragment() with too few arguments must throw TypeError]
expected: FAIL
- [DocumentType interface: existence and properties of interface object]
- expected: FAIL
-
- [Element interface: existence and properties of interface object]
- expected: FAIL
-
[Element interface: operation hasAttributes()]
expected: FAIL
@@ -180,24 +162,9 @@
[NamedNodeMap interface: operation setNamedItemNS(Attr)]
expected: FAIL
- [CharacterData interface: existence and properties of interface object]
- expected: FAIL
-
- [Text interface: existence and properties of interface object]
- expected: FAIL
-
- [ProcessingInstruction interface: existence and properties of interface object]
- expected: FAIL
-
- [Comment interface: existence and properties of interface object]
- expected: FAIL
-
[Range interface: stringifier]
expected: FAIL
- [NodeFilter interface: existence and properties of interface object]
- expected: FAIL
-
[DOMSettableTokenList interface: existence and properties of interface prototype object]
expected: FAIL
diff --git a/tests/wpt/metadata/html/dom/interfaces.html.ini b/tests/wpt/metadata/html/dom/interfaces.html.ini
index 0a4948517a1..e1d488e362e 100644
--- a/tests/wpt/metadata/html/dom/interfaces.html.ini
+++ b/tests/wpt/metadata/html/dom/interfaces.html.ini
@@ -1362,9 +1362,6 @@
[HTMLCollection interface: calling namedItem(DOMString) on document.all with too few arguments must throw TypeError]
expected: FAIL
- [HTMLFormControlsCollection interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLFormControlsCollection interface: operation namedItem(DOMString)]
expected: FAIL
@@ -1554,9 +1551,6 @@
[Stringification of document.cssElementMap]
expected: FAIL
- [HTMLElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLElement interface: attribute translate]
expected: FAIL
@@ -2058,27 +2052,12 @@
[Element interface: calling queryAll(DOMString) on document.createElement("noscript") with too few arguments must throw TypeError]
expected: FAIL
- [HTMLUnknownElement interface: existence and properties of interface object]
- expected: FAIL
-
- [HTMLHtmlElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLHtmlElement interface: attribute version]
expected: FAIL
[HTMLHtmlElement interface: document.createElement("html") must inherit property "version" with the proper type (0)]
expected: FAIL
- [HTMLHeadElement interface: existence and properties of interface object]
- expected: FAIL
-
- [HTMLTitleElement interface: existence and properties of interface object]
- expected: FAIL
-
- [HTMLBaseElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLBaseElement interface: attribute href]
expected: FAIL
@@ -2091,9 +2070,6 @@
[HTMLBaseElement interface: document.createElement("base") must inherit property "target" with the proper type (1)]
expected: FAIL
- [HTMLLinkElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLLinkElement interface: attribute crossOrigin]
expected: FAIL
@@ -2109,9 +2085,6 @@
[HTMLLinkElement interface: document.createElement("link") must inherit property "sheet" with the proper type (11)]
expected: FAIL
- [HTMLMetaElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLMetaElement interface: attribute httpEquiv]
expected: FAIL
@@ -2124,9 +2097,6 @@
[HTMLMetaElement interface: document.createElement("meta") must inherit property "scheme" with the proper type (3)]
expected: FAIL
- [HTMLStyleElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLStyleElement interface: attribute media]
expected: FAIL
@@ -2148,9 +2118,6 @@
[HTMLStyleElement interface: document.createElement("style") must inherit property "sheet" with the proper type (3)]
expected: FAIL
- [HTMLBodyElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLBodyElement interface: attribute link]
expected: FAIL
@@ -2235,9 +2202,6 @@
[HTMLBodyElement interface: document.createElement("body") must inherit property "onpopstate" with the proper type (16)]
expected: FAIL
- [HTMLHeadingElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLHeadingElement interface: attribute align]
expected: FAIL
@@ -2259,18 +2223,12 @@
[HTMLHeadingElement interface: document.createElement("h6") must inherit property "align" with the proper type (0)]
expected: FAIL
- [HTMLParagraphElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLParagraphElement interface: attribute align]
expected: FAIL
[HTMLParagraphElement interface: document.createElement("p") must inherit property "align" with the proper type (0)]
expected: FAIL
- [HTMLHRElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLHRElement interface: attribute align]
expected: FAIL
@@ -2289,9 +2247,6 @@
[HTMLHRElement interface: document.createElement("hr") must inherit property "size" with the proper type (3)]
expected: FAIL
- [HTMLPreElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLPreElement interface: attribute width]
expected: FAIL
@@ -2307,9 +2262,6 @@
[HTMLPreElement interface: document.createElement("xmp") must inherit property "width" with the proper type (0)]
expected: FAIL
- [HTMLQuoteElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLQuoteElement interface: attribute cite]
expected: FAIL
@@ -2319,9 +2271,6 @@
[HTMLQuoteElement interface: document.createElement("q") must inherit property "cite" with the proper type (0)]
expected: FAIL
- [HTMLOListElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLOListElement interface: attribute reversed]
expected: FAIL
@@ -2334,18 +2283,12 @@
[HTMLOListElement interface: attribute compact]
expected: FAIL
- [HTMLUListElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLUListElement interface: attribute compact]
expected: FAIL
[HTMLUListElement interface: attribute type]
expected: FAIL
- [HTMLLIElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLLIElement interface: attribute value]
expected: FAIL
@@ -2358,18 +2301,9 @@
[HTMLLIElement interface: document.createElement("li") must inherit property "type" with the proper type (1)]
expected: FAIL
- [HTMLDListElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLDListElement interface: attribute compact]
expected: FAIL
- [HTMLDivElement interface: existence and properties of interface object]
- expected: FAIL
-
- [HTMLAnchorElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLAnchorElement interface: attribute target]
expected: FAIL
@@ -2412,39 +2346,24 @@
[HTMLAnchorElement interface: document.createElement("a") must inherit property "charset" with the proper type (9)]
expected: FAIL
- [HTMLDataElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLDataElement interface: attribute value]
expected: FAIL
[HTMLDataElement interface: document.createElement("data") must inherit property "value" with the proper type (0)]
expected: FAIL
- [HTMLTimeElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLTimeElement interface: attribute dateTime]
expected: FAIL
[HTMLTimeElement interface: document.createElement("time") must inherit property "dateTime" with the proper type (0)]
expected: FAIL
- [HTMLSpanElement interface: existence and properties of interface object]
- expected: FAIL
-
- [HTMLBRElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLBRElement interface: attribute clear]
expected: FAIL
[HTMLBRElement interface: document.createElement("br") must inherit property "clear" with the proper type (0)]
expected: FAIL
- [HTMLModElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLModElement interface: attribute cite]
expected: FAIL
@@ -2481,9 +2400,6 @@
[Stringification of document.createElement("picture")]
expected: FAIL
- [HTMLImageElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLImageElement interface: attribute srcset]
expected: FAIL
@@ -2529,9 +2445,6 @@
[HTMLImageElement interface: new Image() must inherit property "lowsrc" with the proper type (14)]
expected: FAIL
- [HTMLIFrameElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLIFrameElement interface: attribute srcdoc]
expected: FAIL
@@ -2562,9 +2475,6 @@
[HTMLIFrameElement interface: attribute marginWidth]
expected: FAIL
- [HTMLEmbedElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLEmbedElement interface: attribute src]
expected: FAIL
@@ -2613,9 +2523,6 @@
[HTMLEmbedElement interface: document.createElement("embed") must inherit property "name" with the proper type (7)]
expected: FAIL
- [HTMLObjectElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLObjectElement interface: attribute data]
expected: FAIL
@@ -2772,9 +2679,6 @@
[HTMLObjectElement interface: document.createElement("object") must inherit property "border" with the proper type (26)]
expected: FAIL
- [HTMLParamElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLParamElement interface: attribute name]
expected: FAIL
@@ -2799,9 +2703,6 @@
[HTMLParamElement interface: document.createElement("param") must inherit property "valueType" with the proper type (3)]
expected: FAIL
- [HTMLVideoElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLVideoElement interface: attribute width]
expected: FAIL
@@ -2973,9 +2874,6 @@
[HTMLMediaElement interface: calling addTextTrack(TextTrackKind,DOMString,DOMString) on document.createElement("video") with too few arguments must throw TypeError]
expected: FAIL
- [HTMLAudioElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLMediaElement interface: document.createElement("audio") must inherit property "error" with the proper type (0)]
expected: FAIL
@@ -3264,9 +3162,6 @@
[HTMLMediaElement interface: calling addTextTrack(TextTrackKind,DOMString,DOMString) on new Audio() with too few arguments must throw TypeError]
expected: FAIL
- [HTMLSourceElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLSourceElement interface: attribute src]
expected: FAIL
@@ -3297,9 +3192,6 @@
[HTMLSourceElement interface: document.createElement("source") must inherit property "media" with the proper type (4)]
expected: FAIL
- [HTMLTrackElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLTrackElement interface: attribute kind]
expected: FAIL
@@ -3378,9 +3270,6 @@
[HTMLTrackElement interface: document.createElement("track") must inherit property "track" with the proper type (10)]
expected: FAIL
- [HTMLMediaElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLMediaElement interface: attribute error]
expected: FAIL
@@ -4284,9 +4173,6 @@
[Event interface: calling initEvent(DOMString,boolean,boolean) on new TrackEvent("addtrack"; {track:document.createElement("track").track}) with too few arguments must throw TypeError]
expected: FAIL
- [HTMLMapElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLMapElement interface: attribute name]
expected: FAIL
@@ -4305,9 +4191,6 @@
[HTMLMapElement interface: document.createElement("map") must inherit property "images" with the proper type (2)]
expected: FAIL
- [HTMLAreaElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLAreaElement interface: attribute alt]
expected: FAIL
@@ -4356,9 +4239,6 @@
[HTMLAreaElement interface: document.createElement("area") must inherit property "noHref" with the proper type (10)]
expected: FAIL
- [HTMLTableElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLTableElement interface: attribute tHead]
expected: FAIL
@@ -4479,18 +4359,12 @@
[HTMLTableElement interface: document.createElement("table") must inherit property "cellSpacing" with the proper type (24)]
expected: FAIL
- [HTMLTableCaptionElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLTableCaptionElement interface: attribute align]
expected: FAIL
[HTMLTableCaptionElement interface: document.createElement("caption") must inherit property "align" with the proper type (0)]
expected: FAIL
- [HTMLTableColElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLTableColElement interface: attribute span]
expected: FAIL
@@ -4545,9 +4419,6 @@
[HTMLTableColElement interface: document.createElement("col") must inherit property "width" with the proper type (5)]
expected: FAIL
- [HTMLTableSectionElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLTableSectionElement interface: attribute align]
expected: FAIL
@@ -4596,9 +4467,6 @@
[HTMLTableSectionElement interface: document.createElement("tfoot") must inherit property "vAlign" with the proper type (6)]
expected: FAIL
- [HTMLTableRowElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLTableRowElement interface: attribute rowIndex]
expected: FAIL
@@ -4635,9 +4503,6 @@
[HTMLTableRowElement interface: document.createElement("tr") must inherit property "vAlign" with the proper type (8)]
expected: FAIL
- [HTMLTableDataCellElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLTableDataCellElement interface: attribute abbr]
expected: FAIL
@@ -4671,9 +4536,6 @@
[HTMLTableCellElement interface: document.createElement("td") must inherit property "vAlign" with the proper type (11)]
expected: FAIL
- [HTMLTableHeaderCellElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLTableHeaderCellElement interface: attribute scope]
expected: FAIL
@@ -4725,9 +4587,6 @@
[HTMLTableCellElement interface: document.createElement("th") must inherit property "vAlign" with the proper type (11)]
expected: FAIL
- [HTMLTableCellElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLTableCellElement interface: attribute rowSpan]
expected: FAIL
@@ -4755,9 +4614,6 @@
[HTMLTableCellElement interface: attribute vAlign]
expected: FAIL
- [HTMLFormElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLFormElement interface: operation checkValidity()]
expected: FAIL
@@ -4776,12 +4632,6 @@
[HTMLFormElement interface: document.createElement("form") must inherit property "requestAutocomplete" with the proper type (17)]
expected: FAIL
- [HTMLLabelElement interface: existence and properties of interface object]
- expected: FAIL
-
- [HTMLInputElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLInputElement interface: attribute accept]
expected: FAIL
@@ -5034,9 +4884,6 @@
[HTMLInputElement interface: document.createElement("input") must inherit property "useMap" with the proper type (57)]
expected: FAIL
- [HTMLButtonElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLButtonElement interface: attribute autofocus]
expected: FAIL
@@ -5082,9 +4929,6 @@
[HTMLButtonElement interface: calling setCustomValidity(DOMString) on document.createElement("button") with too few arguments must throw TypeError]
expected: FAIL
- [HTMLSelectElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLSelectElement interface: attribute autocomplete]
expected: FAIL
@@ -5190,21 +5034,12 @@
[HTMLSelectElement interface: calling setCustomValidity(DOMString) on document.createElement("select") with too few arguments must throw TypeError]
expected: FAIL
- [HTMLDataListElement interface: existence and properties of interface object]
- expected: FAIL
-
- [HTMLOptGroupElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLOptGroupElement interface: attribute label]
expected: FAIL
[HTMLOptGroupElement interface: document.createElement("optgroup") must inherit property "label" with the proper type (1)]
expected: FAIL
- [HTMLOptionElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLOptionElement interface: attribute form]
expected: FAIL
@@ -5217,9 +5052,6 @@
[HTMLOptionElement interface: document.createElement("option") must inherit property "index" with the proper type (7)]
expected: FAIL
- [HTMLTextAreaElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLTextAreaElement interface: attribute autocomplete]
expected: FAIL
@@ -5457,9 +5289,6 @@
[HTMLKeygenElement interface: document.createElement("keygen") must inherit property "labels" with the proper type (13)]
expected: FAIL
- [HTMLOutputElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLOutputElement interface: attribute htmlFor]
expected: FAIL
@@ -5523,9 +5352,6 @@
[HTMLOutputElement interface: calling setCustomValidity(DOMString) on document.createElement("output") with too few arguments must throw TypeError]
expected: FAIL
- [HTMLProgressElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLProgressElement interface: attribute value]
expected: FAIL
@@ -5544,9 +5370,6 @@
[HTMLProgressElement interface: document.createElement("progress") must inherit property "position" with the proper type (2)]
expected: FAIL
- [HTMLMeterElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLMeterElement interface: attribute value]
expected: FAIL
@@ -5583,9 +5406,6 @@
[HTMLMeterElement interface: document.createElement("meter") must inherit property "optimum" with the proper type (5)]
expected: FAIL
- [HTMLFieldSetElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLFieldSetElement interface: attribute name]
expected: FAIL
@@ -5607,9 +5427,6 @@
[HTMLFieldSetElement interface: operation setCustomValidity(DOMString)]
expected: FAIL
- [HTMLLegendElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLLegendElement interface: attribute form]
expected: FAIL
@@ -5820,9 +5637,6 @@
[RelatedEvent interface: attribute relatedTarget]
expected: FAIL
- [HTMLDialogElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLDialogElement interface: operation show([object Object\],[object Object\])]
expected: FAIL
@@ -5832,9 +5646,6 @@
[HTMLDialogElement interface: operation close(DOMString)]
expected: FAIL
- [HTMLScriptElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLScriptElement interface: attribute type]
expected: FAIL
@@ -5877,12 +5688,6 @@
[HTMLScriptElement interface: document.createElement("script") must inherit property "htmlFor" with the proper type (8)]
expected: FAIL
- [HTMLTemplateElement interface: existence and properties of interface object]
- expected: FAIL
-
- [HTMLCanvasElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLCanvasElement interface: operation probablySupportsContext(DOMString,any)]
expected: FAIL
@@ -6402,9 +6207,6 @@
[DragEvent interface: attribute dataTransfer]
expected: FAIL
- [Window interface: existence and properties of interface object]
- expected: FAIL
-
[Window interface: existence and properties of interface prototype object]
expected: FAIL
@@ -7461,9 +7263,6 @@
[EventTarget interface: calling dispatchEvent(Event) on window.applicationCache with too few arguments must throw TypeError]
expected: FAIL
- [ErrorEvent interface: existence and properties of interface object]
- expected: FAIL
-
[Navigator interface: attribute language]
expected: FAIL
@@ -7719,9 +7518,6 @@
[ImageBitmap interface: attribute height]
expected: FAIL
- [MessageEvent interface: existence and properties of interface object]
- expected: FAIL
-
[MessageEvent interface: attribute source]
expected: FAIL
@@ -7731,18 +7527,9 @@
[MessageEvent interface: operation initMessageEvent(DOMString,boolean,boolean,any,DOMString,DOMString,[object Object\],[object Object\],MessagePort)]
expected: FAIL
- [EventSource interface: existence and properties of interface object]
- expected: FAIL
-
- [WebSocket interface: existence and properties of interface object]
- expected: FAIL
-
[WebSocket interface: attribute extensions]
expected: FAIL
- [CloseEvent interface: existence and properties of interface object]
- expected: FAIL
-
[MessageChannel interface: existence and properties of interface object]
expected: FAIL
@@ -7833,9 +7620,6 @@
[BroadcastChannel interface: attribute onmessage]
expected: FAIL
- [WorkerGlobalScope interface: existence and properties of interface object]
- expected: FAIL
-
[WorkerGlobalScope interface: operation close()]
expected: FAIL
@@ -7854,9 +7638,6 @@
[WorkerGlobalScope interface: operation createImageBitmap(ImageBitmapSource,long,long,long,long)]
expected: FAIL
- [DedicatedWorkerGlobalScope interface: existence and properties of interface object]
- expected: FAIL
-
[DedicatedWorkerGlobalScope interface: operation postMessage(any,[object Object\])]
expected: FAIL
@@ -7884,9 +7665,6 @@
[SharedWorkerGlobalScope interface: attribute onconnect]
expected: FAIL
- [Worker interface: existence and properties of interface object]
- expected: FAIL
-
[Worker interface: operation terminate()]
expected: FAIL
@@ -7917,12 +7695,6 @@
[WorkerNavigator interface: attribute onLine]
expected: FAIL
- [StorageEvent interface: existence and properties of interface object]
- expected: FAIL
-
- [HTMLAppletElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLAppletElement interface: attribute align]
expected: FAIL
@@ -8097,9 +7869,6 @@
[HTMLMarqueeElement interface: document.createElement("marquee") must inherit property "stop" with the proper type (15)]
expected: FAIL
- [HTMLFrameSetElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLFrameSetElement interface: attribute cols]
expected: FAIL
@@ -8190,9 +7959,6 @@
[HTMLFrameSetElement interface: document.createElement("frameset") must inherit property "onunload" with the proper type (14)]
expected: FAIL
- [HTMLFrameElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLFrameElement interface: attribute name]
expected: FAIL
@@ -8253,18 +8019,12 @@
[HTMLFrameElement interface: document.createElement("frame") must inherit property "marginWidth" with the proper type (9)]
expected: FAIL
- [HTMLDirectoryElement interface: existence and properties of interface object]
- expected: FAIL
-
[HTMLDirectoryElement interface: attribute compact]
expected: FAIL
[HTMLDirectoryElement interface: document.createElement("dir") must inherit property "compact" with the proper type (0)]
expected: FAIL
- [HTMLFontElement interface: existence and properties of interface object]
- expected: FAIL
-
[Window interface: window must inherit property "close" with the proper type (13)]
expected: FAIL
diff --git a/tests/wpt/metadata/webstorage/idlharness.html.ini b/tests/wpt/metadata/webstorage/idlharness.html.ini
index 3df3eb9d734..6885750802e 100644
--- a/tests/wpt/metadata/webstorage/idlharness.html.ini
+++ b/tests/wpt/metadata/webstorage/idlharness.html.ini
@@ -3,9 +3,6 @@
[Window interface: attribute localStorage]
expected: FAIL
- [StorageEvent interface: existence and properties of interface object]
- 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 c8839fa803b..ace10433f09 100644
--- a/tests/wpt/metadata/workers/interfaces.worker.js.ini
+++ b/tests/wpt/metadata/workers/interfaces.worker.js.ini
@@ -1,8 +1,5 @@
[interfaces.worker]
type: testharness
- [WorkerGlobalScope interface: existence and properties of interface object]
- expected: FAIL
-
[WorkerGlobalScope interface: operation close()]
expected: FAIL
@@ -18,9 +15,6 @@
[WorkerGlobalScope interface: attribute ononline]
expected: FAIL
- [DedicatedWorkerGlobalScope interface: existence and properties of interface object]
- expected: FAIL
-
[DedicatedWorkerGlobalScope interface: operation postMessage(any,[object Object\])]
expected: FAIL