gecko/dom/bindings/Bindings.conf

356 lines
12 KiB
Plaintext

# 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/.
# DOM Bindings Configuration.
#
# The WebIDL interfaces are defined in dom/webidl. For each such interface, there
# is a corresponding entry in the configuration table below. The configuration
# table maps each interface name to a |descriptor| or list of |descriptor|s.
#
# Valid fields for all descriptors:
# * nativeType - The native type (concrete class or XPCOM interface) that
# instances of this interface will unwrap to (required).
# * headerFile - The file in which the nativeType is declared (defaults
# to an educated guess).
# * castable - Indicates whether the value in the wrapper can be cast to
# nativeType, or whether it needs to be QI-ed (defaults to True
# for everything but callback interfaces and external interfaces,
# for which it defaults to false and is not allowed to be set
# at all).
# * concrete - Indicates whether there exist objects with this interface as
# their primary interface (defaults to True).
# * prefable - Indicates whether this binding is subject to the about:config
# pref, or whether it's always enabled (defaults to False).
# Cannot be set on external interfaces.
# * workers - Indicates whether the descriptor is intended to be used for
# worker threads (defaults to false).
# * customTrace - The native class will use a custom trace hook (defaults to
# true for workers, false otherwise).
# * customFinalize - The native class will use a custom finalize hook
# (defaults to true for workers, false otherwise).
# * notflattened - The native type does not have nsIClassInfo, so when
# wrapping it the right IID needs to be passed in.
# * register - True if this binding should be registered. Defaults to true.
# * binaryNames - Dict for mapping method and attribute names to different
# names when calling the native methods (defaults to an empty
# dict). The keys are the property names as they appear in the
# .webidl file and the values are the names as they should be
# in the WebIDL.
# * wrapperCache: True if this object is a wrapper cache. Objects that are
# not can only be returned from a limited set of methods,
# cannot be prefable, and must ensure that they disallow
# XPConnect wrapping. Always true for worker descriptors.
# Defaults to true.
#
# The following fields are either a string, an array (defaults to an empty
# array) or a dictionary with three possible keys (all, getterOnly and
# setterOnly) each having such an array as the value
#
# * implicitJSContext - attributes and methods specified in the .webidl file
# that require a JSContext as the first argument
# * resultNotAddRefed - attributes and methods specified in the .webidl file
# that do not AddRef the return value
DOMInterfaces = {
'Blob': [
{
'nativeType': 'nsIDOMBlob',
'headerFile': 'nsIDOMFile.h',
},
{
'workers': True,
'nativeType': 'JSObject',
'headerFile': 'jsapi.h',
}],
'CanvasRenderingContext2D': [
{
'nativeType': 'nsCanvasRenderingContext2DAzure',
# Making this non-prefable requires that we ensure that nothing takes this
# type as an argument or that the non-Azure variant is removed.
'prefable': True,
'implicitJSContext': [
'createImageData', 'getImageData', 'putImageData', 'strokeStyle',
'fillStyle', 'mozDash'
],
'resultNotAddRefed': [ 'canvas' ],
'binaryNames': {
'mozImageSmoothingEnabled': 'imageSmoothingEnabled',
'mozFillRule': 'fillRule'
}
}],
'Document': [
{
'nativeType': 'nsIDocument',
},
{
'workers': True,
'nativeType': 'JSObject',
'headerFile': 'jsapi.h',
}],
'Event': [
{
'nativeType': 'nsIDOMEvent',
},
{
'workers': True,
'nativeType': 'JSObject',
'headerFile': 'jsapi.h',
}],
'EventListener': [
{
'nativeType': 'nsIDOMEventListener',
'prefable': True
},
{
'workers': True,
'nativeType': 'JSObject',
'headerFile': 'jsapi.h'
}],
'EventTarget': [
{
'nativeType': 'nsDOMEventTargetHelper',
'hasInstanceInterface': 'nsIDOMEventTarget',
'concrete': False,
'prefable': True,
},
{
'workers': True,
'nativeType': 'mozilla::dom::workers::EventTarget',
'headerFile': 'mozilla/dom/workers/bindings/EventTarget.h',
'concrete': False
}],
'FormData': [
{
'nativeType': 'nsIDOMFormData',
},
{
'workers': True,
'nativeType': 'JSObject',
'headerFile': 'jsapi.h',
}],
'IID': [
{
'nativeType': 'nsIJSIID',
'headerFile': 'xpcjsid.h',
},
{
'workers': True,
'nativeType': 'JSObject',
'headerFile': 'jsapi.h',
}],
'InputStream': [
{
'nativeType': 'nsIInputStream',
'notflattened': True
},
{
'workers': True,
'nativeType': 'JSObject',
'headerFile': 'jsapi.h',
}],
'MozChannel': [
{
'nativeType': 'nsIChannel',
'notflattened': True
},
{
'workers': True,
'nativeType': 'JSObject',
'headerFile': 'jsapi.h',
}],
'Performance': {
'nativeType': 'nsPerformance',
'resultNotAddRefed': [ 'timing', 'navigation' ]
},
'PerformanceTiming': {
'nativeType': 'nsPerformanceTiming',
'headerFile': 'nsPerformance.h'
},
'PerformanceNavigation': {
'nativeType': 'nsPerformanceNavigation',
'headerFile': 'nsPerformance.h'
},
'WebGLRenderingContext': {
'nativeType': 'mozilla::WebGLContext',
'headerFile': 'WebGLContext.h',
'prefable': True,
'resultNotAddRefed': [ 'canvas', 'getContextAttributes', 'getExtension',
'getAttachedShaders' ],
'implicitJSContext': [ 'texImage2D', 'texSubImage2D' ],
},
'WebGLUniformLocation': {
'nativeType': 'mozilla::WebGLUniformLocation',
'headerFile': 'WebGLContext.h',
'wrapperCache': False
},
'XMLHttpRequest': [
{
'nativeType': 'nsXMLHttpRequest',
'prefable': True,
'implicitJSContext': [ 'constructor', ],
'resultNotAddRefed': [ 'upload', 'responseXML' ]
},
{
'workers': True,
'nativeType': 'mozilla::dom::workers::XMLHttpRequest',
'headerFile': 'mozilla/dom/workers/bindings/XMLHttpRequest.h',
}],
'XMLHttpRequestEventTarget': [
{
'nativeType': 'nsXHREventTarget',
'headerFile': 'nsXMLHttpRequest.h',
'concrete': False,
'prefable': True,
},
{
'workers': True,
'concrete': False,
'nativeType': 'mozilla::dom::workers::XMLHttpRequestEventTarget',
'headerFile': 'mozilla/dom/workers/bindings/XMLHttpRequestEventTarget.h'
}],
'XMLHttpRequestUpload': [
{
'nativeType': 'nsXMLHttpRequestUpload',
'headerFile': 'nsXMLHttpRequest.h',
'prefable': True
},
{
'workers': True,
'nativeType': 'mozilla::dom::workers::XMLHttpRequestUpload',
'headerFile': 'mozilla/dom/workers/bindings/XMLHttpRequestUpload.h'
}],
####################################
# Test Interfaces of various sorts #
####################################
'TestInterface' : {
'nativeType': 'mozilla::dom::TestInterface',
'headerFile': 'TestBindingHeader.h',
'register': False,
'resultNotAddRefed': [ 'receiveWeakSelf', 'receiveWeakNullableSelf',
'receiveWeakOther', 'receiveWeakNullableOther',
'receiveWeakExternal', 'receiveWeakNullableExternal',
'ReceiveWeakCallbackInterface',
'ReceiveWeakNullableCallbackInterface',
'receiveWeakCastableObjectSequence',
'receiveWeakNullableCastableObjectSequence',
'receiveWeakCastableObjectNullableSequence',
'receiveWeakNullableCastableObjectNullableSequence' ],
'binaryNames': { 'methodRenamedFrom': 'methodRenamedTo',
'attributeGetterRenamedFrom': 'attributeGetterRenamedTo',
'attributeRenamedFrom': 'attributeRenamedTo' }
},
'TestNonCastableInterface' : {
'nativeType': 'mozilla::dom::TestNonCastableInterface',
'headerFile': 'TestBindingHeader.h',
'register': False,
'castable': False
},
'TestExternalInterface' : {
'nativeType': 'mozilla::dom::TestExternalInterface',
'headerFile': 'TestBindingHeader.h',
'register': False
},
'TestNonWrapperCacheInterface' : {
'nativeType': 'mozilla::dom::TestNonWrapperCacheInterface',
'headerFile': 'TestBindingHeader.h',
'register': False,
'wrapperCache': False
},
'TestCallbackInterface': {
'nativeType': 'mozilla::dom::TestCallbackInterface',
'headerFile': 'TestBindingHeader.h',
'register': False
},
'IndirectlyImplementedInterface': {
'nativeType': 'mozilla::dom::IndirectlyImplementedInterface',
'headerFile': 'TestBindingHeader.h',
'register': False,
'castable': False,
'concrete': False
},
'OnlyForUseInConstructor' : {
'nativeType': 'mozilla::dom::OnlyForUseInConstructor',
'headerFile': 'TestBindingHeader.h',
'register': False
},
}
# These are temporary, until they've been converted to use new DOM bindings
def addExternalIface(iface, nativeType=None, headerFile=None):
if nativeType is None:
nativeType = 'nsIDOM' + iface
domInterface = {
'nativeType': nativeType,
'concrete': False
}
if not headerFile is None:
domInterface['headerFile'] = headerFile
DOMInterfaces[iface] = domInterface
# If you add one of these, you need to make sure nsDOMQS.h has the relevant
# macros added for it
def addExternalHTMLElement(element):
nativeElement = 'ns' + element
addExternalIface(element, nativeType=nativeElement,
headerFile=nativeElement + '.h')
addExternalHTMLElement('HTMLCanvasElement')
addExternalHTMLElement('HTMLImageElement')
addExternalHTMLElement('HTMLVideoElement')
addExternalIface('CanvasGradient', headerFile='nsIDOMCanvasRenderingContext2D.h')
addExternalIface('CanvasPattern', headerFile='nsIDOMCanvasRenderingContext2D.h')
addExternalIface('HitRegionOptions', nativeType='nsISupports')
addExternalIface('ImageData', nativeType='mozilla::dom::ImageData')
addExternalIface('TextMetrics', headerFile='nsIDOMCanvasRenderingContext2D.h')
addExternalIface('WebGLActiveInfo', nativeType='mozilla::WebGLActiveInfo',
headerFile='WebGLContext.h')
addExternalIface('WebGLBuffer', nativeType='mozilla::WebGLBuffer',
headerFile='WebGLContext.h')
addExternalIface('WebGLContextAttributes', nativeType='JSObject',
headerFile='jsapi.h')
addExternalIface('WebGLExtension', nativeType='nsIWebGLExtension',
headerFile='WebGLContext.h')
addExternalIface('WebGLFramebuffer', nativeType='mozilla::WebGLFramebuffer',
headerFile='WebGLContext.h')
addExternalIface('WebGLProgram', nativeType='mozilla::WebGLProgram',
headerFile='WebGLContext.h')
addExternalIface('WebGLRenderbuffer', nativeType='mozilla::WebGLRenderbuffer',
headerFile='WebGLContext.h')
addExternalIface('WebGLShader', nativeType='mozilla::WebGLShader',
headerFile='WebGLContext.h')
addExternalIface('WebGLShaderPrecisionFormat',
nativeType='mozilla::WebGLShaderPrecisionFormat',
headerFile='WebGLContext.h')
addExternalIface('WebGLTexture', nativeType='mozilla::WebGLTexture',
headerFile='WebGLContext.h')
addExternalIface('Window')
addExternalIface('XULElement')