mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Remove support for some obsolete configurations.
This commit is contained in:
parent
8429df46cc
commit
8360aa24d6
2 changed files with 11 additions and 83 deletions
|
@ -960,11 +960,6 @@ for (uint32_t i = 0; i < length; ++i) {
|
||||||
|
|
||||||
templateBody = ""
|
templateBody = ""
|
||||||
if descriptor.castable:
|
if descriptor.castable:
|
||||||
if descriptor.prefable:
|
|
||||||
raise TypeError("We don't support prefable castable object "
|
|
||||||
"arguments (like %s), because we don't know "
|
|
||||||
"how to handle them being preffed off" %
|
|
||||||
descriptor.interface.identifier.name)
|
|
||||||
if descriptor.interface.isConsequential():
|
if descriptor.interface.isConsequential():
|
||||||
raise TypeError("Consequential interface %s being used as an "
|
raise TypeError("Consequential interface %s being used as an "
|
||||||
"argument but flagged as castable" %
|
"argument but flagged as castable" %
|
||||||
|
@ -1574,21 +1569,11 @@ for (uint32_t i = 0; i < length; ++i) {
|
||||||
if (not descriptor.interface.isExternal() and
|
if (not descriptor.interface.isExternal() and
|
||||||
not descriptor.interface.isCallback()):
|
not descriptor.interface.isCallback()):
|
||||||
wrap = "GetReflector(cx, (%s).reflector(), ${jsvalPtr} as *mut JSVal)" % result
|
wrap = "GetReflector(cx, (%s).reflector(), ${jsvalPtr} as *mut JSVal)" % result
|
||||||
# We don't support prefable stuff in workers.
|
# Non-prefable bindings can only fail to wrap as a new-binding object
|
||||||
assert(not descriptor.prefable or not descriptor.workers)
|
# if they already threw an exception. Same thing for
|
||||||
if not descriptor.prefable:
|
# non-prefable bindings.
|
||||||
# Non-prefable bindings can only fail to wrap as a new-binding object
|
failed = ("assert!(unsafe { JS_IsExceptionPending(cx) != 0 });\n" +
|
||||||
# if they already threw an exception. Same thing for
|
"%s" % exceptionCode)
|
||||||
# non-prefable bindings.
|
|
||||||
failed = ("assert!(unsafe { JS_IsExceptionPending(cx) != 0 });\n" +
|
|
||||||
"%s" % exceptionCode)
|
|
||||||
else:
|
|
||||||
if descriptor.notflattened:
|
|
||||||
raise TypeError("%s is prefable but not flattened; "
|
|
||||||
"fallback won't work correctly" %
|
|
||||||
descriptor.interface.identifier.name)
|
|
||||||
# Try old-style wrapping for bindings which might be preffed off.
|
|
||||||
failed = wrapAndSetPtr("HandleNewBindingWrappingFailure(cx, ${obj}, %s, ${jsvalPtr})" % result)
|
|
||||||
wrappingCode += wrapAndSetPtr(wrap, failed)
|
wrappingCode += wrapAndSetPtr(wrap, failed)
|
||||||
else:
|
else:
|
||||||
wrap = "GetReflector(cx, (%s).reflector(), ${jsvalPtr} as *mut JSVal)" % result
|
wrap = "GetReflector(cx, (%s).reflector(), ${jsvalPtr} as *mut JSVal)" % result
|
||||||
|
@ -2238,8 +2223,7 @@ def DOMClass(descriptor):
|
||||||
return """DOMClass {
|
return """DOMClass {
|
||||||
interface_chain: [ %s ] ,
|
interface_chain: [ %s ] ,
|
||||||
unused: %s, native_hooks: %s
|
unused: %s, native_hooks: %s
|
||||||
}""" % (prototypeChainString, "false", #toStringBool(descriptor.nativeIsISupports),
|
}""" % (prototypeChainString, "false", nativeHooks)
|
||||||
nativeHooks)
|
|
||||||
|
|
||||||
class CGDOMJSClass(CGThing):
|
class CGDOMJSClass(CGThing):
|
||||||
"""
|
"""
|
||||||
|
@ -2252,7 +2236,7 @@ class CGDOMJSClass(CGThing):
|
||||||
#return "extern DOMJSClass Class;\n"
|
#return "extern DOMJSClass Class;\n"
|
||||||
return ""
|
return ""
|
||||||
def define(self):
|
def define(self):
|
||||||
traceHook = "Some(%s)" % TRACE_HOOK_NAME if self.descriptor.customTrace else 'None'
|
traceHook = "Some(%s)" % TRACE_HOOK_NAME
|
||||||
if self.descriptor.createGlobal:
|
if self.descriptor.createGlobal:
|
||||||
flags = "JSCLASS_IS_GLOBAL"
|
flags = "JSCLASS_IS_GLOBAL"
|
||||||
slots = "JSCLASS_GLOBAL_SLOT_COUNT + 1"
|
slots = "JSCLASS_GLOBAL_SLOT_COUNT + 1"
|
||||||
|
@ -2291,7 +2275,6 @@ static Class: DOMJSClass = DOMJSClass {
|
||||||
""" % (len(self.descriptor.interface.identifier.name) + 1,
|
""" % (len(self.descriptor.interface.identifier.name) + 1,
|
||||||
str_to_const_array(self.descriptor.interface.identifier.name),
|
str_to_const_array(self.descriptor.interface.identifier.name),
|
||||||
flags, slots, slots,
|
flags, slots, slots,
|
||||||
#ADDPROPERTY_HOOK_NAME if self.descriptor.concrete and not self.descriptor.workers and self.descriptor.wrapperCache else 'crust::JS_PropertyStub',
|
|
||||||
'crust::JS_PropertyStub',
|
'crust::JS_PropertyStub',
|
||||||
FINALIZE_HOOK_NAME, traceHook,
|
FINALIZE_HOOK_NAME, traceHook,
|
||||||
CGIndenter(CGGeneric(DOMClass(self.descriptor))).define())
|
CGIndenter(CGGeneric(DOMClass(self.descriptor))).define())
|
||||||
|
@ -2702,27 +2685,6 @@ class CGWrapMethod(CGAbstractMethod):
|
||||||
def definition_body(self):
|
def definition_body(self):
|
||||||
return "return Wrap_(aCx, aScope, aObject);"
|
return "return Wrap_(aCx, aScope, aObject);"
|
||||||
|
|
||||||
class CGWrapNonWrapperCacheMethod(CGAbstractMethod):
|
|
||||||
def __init__(self, descriptor):
|
|
||||||
# XXX can we wrap if we don't have an interface prototype object?
|
|
||||||
assert descriptor.interface.hasInterfacePrototypeObject()
|
|
||||||
args = [Argument('JSContext*', 'aCx'), Argument('JSObject*', 'aScope'),
|
|
||||||
Argument('@' + descriptor.nativeType, 'aObject')]
|
|
||||||
CGAbstractMethod.__init__(self, descriptor, 'Wrap', 'JSObject*', args)
|
|
||||||
|
|
||||||
def definition_body(self):
|
|
||||||
return """
|
|
||||||
JSObject* global = JS_GetGlobalForObject(aCx, aScope);
|
|
||||||
JSObject* proto = GetProtoObject(aCx, global, global);
|
|
||||||
if (!proto) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
%s
|
|
||||||
NS_ADDREF(aObject);
|
|
||||||
|
|
||||||
return obj;""" % CreateBindingJSObject(self.descriptor, "global")
|
|
||||||
|
|
||||||
class CGAbstractExternMethod(CGAbstractMethod):
|
class CGAbstractExternMethod(CGAbstractMethod):
|
||||||
"""
|
"""
|
||||||
Abstract base class for codegen of implementation-only (no
|
Abstract base class for codegen of implementation-only (no
|
||||||
|
@ -3030,7 +2992,7 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
|
||||||
CreateProxyHandler(ptr::to_unsafe_ptr(&traps), ptr::to_unsafe_ptr(&Class) as *libc::c_void));
|
CreateProxyHandler(ptr::to_unsafe_ptr(&traps), ptr::to_unsafe_ptr(&Class) as *libc::c_void));
|
||||||
|
|
||||||
""" % (FINALIZE_HOOK_NAME,
|
""" % (FINALIZE_HOOK_NAME,
|
||||||
('Some(%s)' % TRACE_HOOK_NAME) if self.descriptor.customTrace else 'None',
|
('Some(%s)' % TRACE_HOOK_NAME),
|
||||||
self.descriptor.name)
|
self.descriptor.name)
|
||||||
else:
|
else:
|
||||||
body += """ (*page).js_info.get_ref().dom_static.attribute_ids.insert(PrototypeList::id::%s as uint,
|
body += """ (*page).js_info.get_ref().dom_static.attribute_ids.insert(PrototypeList::id::%s as uint,
|
||||||
|
@ -4883,16 +4845,10 @@ class CGAbstractClassHook(CGAbstractExternMethod):
|
||||||
assert(False)
|
assert(False)
|
||||||
|
|
||||||
def finalizeHook(descriptor, hookName, context):
|
def finalizeHook(descriptor, hookName, context):
|
||||||
if descriptor.customFinalize:
|
|
||||||
return """if (this) {
|
|
||||||
this->%s(%s);
|
|
||||||
}""" % (hookName, context)
|
|
||||||
#clearWrapper = "ClearWrapper(self, self);\n" if descriptor.wrapperCache else ""
|
|
||||||
if descriptor.workers:
|
if descriptor.workers:
|
||||||
#release = "self->Release();"
|
#release = "self->Release();"
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
assert descriptor.nativeIsISupports
|
|
||||||
release = """let val = JS_GetReservedSlot(obj, dom_object_slot(obj));
|
release = """let val = JS_GetReservedSlot(obj, dom_object_slot(obj));
|
||||||
let _: %s %s = cast::transmute(RUST_JSVAL_TO_PRIVATE(val));
|
let _: %s %s = cast::transmute(RUST_JSVAL_TO_PRIVATE(val));
|
||||||
debug!("%s finalize: {:p}", this);
|
debug!("%s finalize: {:p}", this);
|
||||||
|
@ -5066,17 +5022,8 @@ class CGDescriptor(CGThing):
|
||||||
# lenientThis=True))
|
# lenientThis=True))
|
||||||
|
|
||||||
if descriptor.concrete:
|
if descriptor.concrete:
|
||||||
if not descriptor.workers and descriptor.wrapperCache:
|
|
||||||
#cgThings.append(CGAddPropertyHook(descriptor))
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Always have a finalize hook, regardless of whether the class wants a
|
|
||||||
# custom hook.
|
|
||||||
cgThings.append(CGClassFinalizeHook(descriptor))
|
cgThings.append(CGClassFinalizeHook(descriptor))
|
||||||
|
cgThings.append(CGClassTraceHook(descriptor))
|
||||||
# Only generate a trace hook if the class wants a custom hook.
|
|
||||||
if (descriptor.customTrace):
|
|
||||||
cgThings.append(CGClassTraceHook(descriptor))
|
|
||||||
|
|
||||||
if descriptor.interface.hasInterfaceObject():
|
if descriptor.interface.hasInterfaceObject():
|
||||||
cgThings.append(CGClassConstructHook(descriptor))
|
cgThings.append(CGClassConstructHook(descriptor))
|
||||||
|
@ -5141,13 +5088,8 @@ class CGDescriptor(CGThing):
|
||||||
cgThings.append(CGDOMJSClass(descriptor))
|
cgThings.append(CGDOMJSClass(descriptor))
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if descriptor.wrapperCache:
|
cgThings.append(CGWrapWithCacheMethod(descriptor))
|
||||||
cgThings.append(CGWrapWithCacheMethod(descriptor))
|
cgThings.append(CGWrapMethod(descriptor))
|
||||||
cgThings.append(CGWrapMethod(descriptor))
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
cgThings.append(CGWrapNonWrapperCacheMethod(descriptor))
|
|
||||||
pass
|
|
||||||
|
|
||||||
cgThings = CGList((CGIndenter(t, declareOnly=True) for t in cgThings), "\n")
|
cgThings = CGList((CGIndenter(t, declareOnly=True) for t in cgThings), "\n")
|
||||||
cgThings = CGWrapper(cgThings, pre='\n', post='\n')
|
cgThings = CGWrapper(cgThings, pre='\n', post='\n')
|
||||||
|
|
|
@ -246,20 +246,6 @@ class Descriptor(DescriptorProvider):
|
||||||
iface.setUserData('hasProxyDescendant', True)
|
iface.setUserData('hasProxyDescendant', True)
|
||||||
iface = iface.parent
|
iface = iface.parent
|
||||||
|
|
||||||
if self.interface.isExternal() and 'prefable' in desc:
|
|
||||||
raise TypeError("%s is external but has a prefable setting" %
|
|
||||||
self.interface.identifier.name)
|
|
||||||
self.prefable = desc.get('prefable', False)
|
|
||||||
|
|
||||||
self.nativeIsISupports = not self.workers
|
|
||||||
self.customTrace = desc.get('customTrace', self.workers) or 'trace'
|
|
||||||
self.customFinalize = desc.get('customFinalize', self.workers)
|
|
||||||
self.wrapperCache = self.workers or desc.get('wrapperCache', True)
|
|
||||||
|
|
||||||
if not self.wrapperCache and self.prefable:
|
|
||||||
raise TypeError("Descriptor for %s is prefable but not wrappercached" %
|
|
||||||
self.interface.identifier.name)
|
|
||||||
|
|
||||||
def make_name(name):
|
def make_name(name):
|
||||||
return name + "_workers" if self.workers else name
|
return name + "_workers" if self.workers else name
|
||||||
self.name = make_name(interface.identifier.name)
|
self.name = make_name(interface.identifier.name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue