Bug 849567 - Automatically handle raw and already_AddRefed return values in Paris bindings and remove resultNotAddRefed, use overloaded functions and auto to select the right type to store return values. r=bz.
authorPeter Van der Beken <peterv@propagandism.org>
Thu, 28 Aug 2014 00:43:56 +0200
changeset 227834 9e0d430f66f3d23d8981bb96a7237197c32818c6
parent 227833 65a8e5b6c2ee7c52c69cc08b2955f4a707d83512
child 227835 5b53e41fe23521f8bc56426509924f5ee93ef4fd
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs849567
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 849567 - Automatically handle raw and already_AddRefed return values in Paris bindings and remove resultNotAddRefed, use overloaded functions and auto to select the right type to store return values. r=bz.
dom/bindings/Bindings.conf
dom/bindings/Codegen.py
dom/bindings/Configuration.py
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -60,18 +60,16 @@
 #                      'refcounted'.
 #
 #   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
 #
 # A descriptor can also have 'skipGen': True specified if it should be skipped
 # when deciding what header includes to generate and should never have an
 # implementation generated for it.  This is only needed in special cases like
 # worker descriptors for objects that will never actually appear in workers.
 #
 # The value for an interface can be a list or a dictionary, which affects which
 # bindings are generated for that interface.
@@ -107,48 +105,38 @@ DOMInterfaces = {
 
 'AudioChannelManager': {
     'nativeType': 'mozilla::dom::system::AudioChannelManager',
     'headerFile': 'AudioChannelManager.h'
 },
 
 'AudioContext': {
     'implicitJSContext': [ 'createBuffer' ],
-    'resultNotAddRefed': [ 'destination', 'listener' ],
 },
 
 'AudioBuffer': {
     'implicitJSContext': [ 'copyToChannel' ],
 },
 
 'AudioBufferSourceNode': {
     'implicitJSContext': [ 'buffer' ],
-    'resultNotAddRefed': [ 'playbackRate' ],
 },
 
 'AudioNode' : {
     'concrete': False,
     'binaryNames': {
         'channelCountMode': 'channelCountModeValue',
         'channelInterpretation': 'channelInterpretationValue',
     },
 },
 
-'AudioProcessingEvent' : {
-    'resultNotAddRefed': [ 'inputBuffer', 'outputBuffer' ],
-},
-
 'BarProp': {
     'headerFile': 'mozilla/dom/BarProps.h',
 },
 
-'BiquadFilterNode': {
-    'resultNotAddRefed': [ 'frequency', 'detune', 'q', 'gain' ],
-},
-
 'Blob': [
 {
     'headerFile': 'nsIDOMFile.h',
 },
 {
     'workers': True,
 }],
 
@@ -208,17 +196,16 @@ DOMInterfaces = {
     'nativeType': 'nsDOMCameraManager',
     'headerFile': 'DOMCameraManager.h'
 },
 
 'CanvasRenderingContext2D': {
     'implicitJSContext': [
         'createImageData', 'getImageData'
     ],
-    'resultNotAddRefed': [ 'canvas', 'measureText' ],
     'binaryNames': {
         'mozImageSmoothingEnabled': 'imageSmoothingEnabled',
         'mozFillRule': 'fillRule'
     }
 },
 
 'CaretPosition' : {
     'nativeType': 'nsDOMCaretPosition',
@@ -239,17 +226,16 @@ DOMInterfaces = {
 },
 
 'Console': {
     'implicitJSContext': [ 'trace', 'time', 'timeEnd' ],
 },
 
 'ConvolverNode': {
     'implicitJSContext': [ 'buffer' ],
-    'resultNotAddRefed': [ 'buffer' ],
 },
 
 'Coordinates': {
     'headerFile': 'nsGeoPosition.h'
 },
 
 'Crypto' : {
     'headerFile': 'Crypto.h'
@@ -260,17 +246,16 @@ DOMInterfaces = {
 },
 
 'CSS2Properties': {
     'nativeType': 'nsDOMCSSDeclaration'
 },
 
 'CSSPrimitiveValue': {
     'nativeType': 'nsROCSSPrimitiveValue',
-    'resultNotAddRefed': ['getRGBColorValue', 'getRectValue']
 },
 
 'CSSStyleDeclaration': {
     'nativeType': 'nsICSSDeclaration'
 },
 
 'CSSStyleSheet': {
     'nativeType': 'mozilla::CSSStyleSheet',
@@ -308,61 +293,45 @@ DOMInterfaces = {
     'implicitJSContext': ['store', 'next', 'close']
 }],
 
 'DedicatedWorkerGlobalScope': {
     'headerFile': 'mozilla/dom/WorkerScope.h',
     'workers': True,
 },
 
-'DelayNode': {
-    'resultNotAddRefed': [ 'delayTime' ],
-},
-
 'DeviceAcceleration': {
     'headerFile': 'mozilla/dom/DeviceMotionEvent.h',
 },
 
 'DeviceRotationRate': {
     'headerFile': 'mozilla/dom/DeviceMotionEvent.h',
 },
 
 'DeviceStorage': {
     'nativeType': 'nsDOMDeviceStorage',
     'headerFile': 'DeviceStorage.h',
 },
 
 'Document': [
 {
     'nativeType': 'nsIDocument',
-    'resultNotAddRefed': [ 'implementation', 'doctype', 'documentElement',
-                           'getElementById', 'adoptNode', 'defaultView',
-                           'activeElement', 'currentScript',
-                           'mozFullScreenElement', 'mozPointerLockElement',
-                           'styleSheets', 'styleSheetSets', 'elementFromPoint',
-                           'querySelector', 'getAnonymousNodes',
-                           'getAnonymousElementByAtribute', 'getBindingParent'
-                           ],
     'binaryNames': {
         'documentURI': 'documentURIFromJS',
         'URL': 'documentURIFromJS'
     }
 },
 # Note: we still need the worker descriptor here because
 # XMLHttpRequest.send() uses it.
 {
     'nativeType': 'JSObject',
     'workers': True,
     'skipGen': True
 }],
 
-'DocumentFragment': {
-    'resultNotAddRefed': [ 'querySelector' ]
-},
-
 'DOMException': {
     'binaryNames': {
         'message': 'messageMoz',
     },
 },
 
 'DOMMatrixReadOnly': {
     'headerFile': 'mozilla/dom/DOMMatrix.h',
@@ -371,27 +340,22 @@ DOMInterfaces = {
 
 'DOMPointReadOnly': {
     'headerFile': 'mozilla/dom/DOMPoint.h',
     'concrete': False,
 },
 
 'DOMRectList': {
     'headerFile': 'mozilla/dom/DOMRect.h',
-    'resultNotAddRefed': [ 'item' ]
 },
 
 'DOMRectReadOnly': {
     'headerFile': 'mozilla/dom/DOMRect.h',
 },
 
-'DOMQuad': {
-    'resultNotAddRefed': [ 'bounds', 'p0', 'p1', 'p2', 'p3' ]
-},
-
 'DOMSettableTokenList': {
     'nativeType': 'nsDOMSettableTokenList',
 },
 
 'DOMStringMap': {
     'nativeType': 'nsDOMStringMap'
 },
 
@@ -406,31 +370,21 @@ DOMInterfaces = {
 
 'DummyInterfaceWorkers': {
     'skipGen': True,
     'register': False,
     'workers': True
 },
 
 'DynamicsCompressorNode': {
-    'resultNotAddRefed': [ 'threshold', 'knee', 'ratio',
-                           'reduction', 'attack', 'release' ],
     'binaryNames': {
         'release': 'getRelease'
     },
 },
 
-'Element': {
-    'resultNotAddRefed': [
-        'classList', 'attributes', 'children', 'firstElementChild',
-        'lastElementChild', 'previousElementSibling', 'nextElementSibling',
-        'getAttributeNode', 'getAttributeNodeNS', 'querySelector'
-    ]
-},
-
 'Event': {
     'implicitJSContext': [ 'defaultPrevented', 'preventDefault' ],
 },
 
 'EventTarget': {
     # When we get rid of hasXPConnectImpls, we can get rid of the
     # couldBeDOMBinding stuff in WrapNewBindingObject.
     'hasXPConnectImpls': True,
@@ -443,17 +397,16 @@ DOMInterfaces = {
     'binaryNames': {
         'message': 'messageMoz',
     },
 },
 
 'FileList': {
     'nativeType': 'nsDOMFileList',
     'headerFile': 'nsDOMFile.h',
-    'resultNotAddRefed': [ 'item' ]
 },
 
 'FileReader': {
     'nativeType': 'nsDOMFileReader',
     'implicitJSContext': [ 'readAsArrayBuffer' ],
 },
 
 'FileReaderSync': {
@@ -466,168 +419,94 @@ DOMInterfaces = {
     'nativeType': 'nsFormData'
 },
 {
     'workers': True,
     'skipGen': True,
     'nativeType': 'JSObject'
 }],
 
-'GainNode': {
-    'resultNotAddRefed': [ 'gain' ],
-},
-
 'Geolocation': {
     'headerFile': 'nsGeolocation.h'
 },
 
 'History': {
     'headerFile': 'nsHistory.h',
     'nativeType': 'nsHistory'
 },
 
-'HmacKeyAlgorithm': {
-    'resultNotAddRefed': ['hash']
-},
-
 'HTMLAppletElement': {
     'nativeType': 'mozilla::dom::HTMLSharedObjectElement'
 },
 
 'HTMLBaseElement': {
     'nativeType': 'mozilla::dom::HTMLSharedElement'
 },
 
 'HTMLCollection': {
     'nativeType': 'nsIHTMLCollection',
     # nsContentList.h pulls in nsIHTMLCollection.h
     'headerFile': 'nsContentList.h',
-    'resultNotAddRefed': [ 'item' ]
-},
-
-'HTMLDataListElement': {
-    'resultNotAddRefed': [
-        'options'
-    ]
 },
 
 'HTMLDirectoryElement': {
     'nativeType': 'mozilla::dom::HTMLSharedElement'
 },
 
 'HTMLDListElement': {
     'nativeType' : 'mozilla::dom::HTMLSharedListElement'
 },
 
 'HTMLDocument': {
     'nativeType': 'nsHTMLDocument',
-    'resultNotAddRefed': [ 'body', 'head', 'images', 'embeds', 'plugins',
-                           'links', 'forms', 'scripts', 'anchors', 'applets' ],
     'implicitJSContext': [ 'open', 'write', 'writeln' ]
 },
 
 'HTMLElement': {
     'nativeType': 'nsGenericHTMLElement',
-    'resultNotAddRefed': [
-        'itemType', 'itemRef', 'itemProp', 'properties', 'contextMenu', 'style',
-        'offsetParent'
-    ]
 },
 
 'HTMLEmbedElement': {
     'nativeType': 'mozilla::dom::HTMLSharedObjectElement'
 },
 
 'HTMLHeadElement': {
     'nativeType': 'mozilla::dom::HTMLSharedElement'
 },
 
 'HTMLHtmlElement': {
     'nativeType': 'mozilla::dom::HTMLSharedElement'
 },
 
-'HTMLLabelElement': {
-    'resultNotAddRefed': [
-        'form', 'control'
-    ],
-},
-
 'HTMLMediaElement': {
     'concrete': False
 },
 
 'HTMLOListElement': {
     'nativeType' : 'mozilla::dom::HTMLSharedListElement'
 },
 
-'HTMLOptionsCollection': {
-    'resultNotAddRefed': [ 'item' ],
-},
-
 'HTMLParamElement': {
     'nativeType': 'mozilla::dom::HTMLSharedElement'
 },
 
 'HTMLPropertiesCollection': {
     'headerFile': 'HTMLPropertiesCollection.h',
-    'resultNotAddRefed': [ 'item', 'namedItem', 'names' ]
 },
 
 'HTMLQuoteElement': {
     'nativeType': 'mozilla::dom::HTMLSharedElement'
 },
 
-'HTMLTableElement': {
-    'resultNotAddRefed': [
-        'caption', 'tHead', 'tFoot', 'tBodies', 'rows'
-    ]
-},
-
-'HTMLTableRowElement': {
-    'resultNotAddRefed': [
-        'cells'
-    ]
-},
-
-'HTMLTableSectionElement': {
-    'resultNotAddRefed': [
-        'rows'
-    ]
-},
-
-'HTMLTemplateElement': {
-    'resultNotAddRefed': [
-        'content'
-    ]
-},
-
 'HTMLTextAreaElement': {
-    'resultNotAddRefed': [
-        'form', 'controllers', 'editor'
-    ],
     'binaryNames': {
         'textLength': 'getTextLength'
     }
 },
 
-'HTMLSelectElement': {
-    'resultNotAddRefed': [
-        'form',
-        'item',
-        'options',
-        'IndexedGetter',
-    ]
-},
-
-'HTMLStyleElement': {
-    'resultNotAddRefed': [
-        'sheet'
-    ]
-},
-
 'HTMLUListElement': {
     'nativeType' : 'mozilla::dom::HTMLSharedListElement'
 },
 
 'IDBCursor': {
     'nativeType': 'mozilla::dom::indexedDB::IDBCursor',
     'implicitJSContext': [ 'delete' ],
     'binaryNames': {
@@ -731,20 +610,16 @@ DOMInterfaces = {
 },
 
 'InstallEvent': {
     'headerFile': 'ServiceWorkerEvents.h',
     'nativeType': 'mozilla::dom::workers::InstallEvent',
     'workers': True
 },
 
-'Key': {
-    'resultNotAddRefed': ['algorithm']
-},
-
 'KeyEvent': {
     'concrete': False
 },
 
 'LocalMediaStream': {
     'headerFile': 'DOMMediaStream.h',
     'nativeType': 'mozilla::DOMLocalMediaStream'
 },
@@ -754,17 +629,16 @@ DOMInterfaces = {
 },
 
 'MediaList': {
     'nativeType': 'nsMediaList',
     'headerFile': 'nsIMediaList.h',
 },
 
 'MediaSource': [{
-    'resultNotAddRefed': [ 'sourceBuffers', 'activeSourceBuffers' ],
 },
 {
     'nativeType': 'JSObject',
     'workers': True,
     'skipGen': True
 }],
 
 'MediaStream': [{
@@ -773,52 +647,46 @@ DOMInterfaces = {
 },
 {
     'nativeType': 'JSObject',
     'workers': True,
     'skipGen': True
 }],
 
 'MediaStreamAudioDestinationNode': {
-    'resultNotAddRefed': [ 'stream' ],
     'binaryNames': { 'stream': 'DOMStream' }
 },
 
 'MediaStreamList': {
     'headerFile': 'MediaStreamList.h',
-    'resultNotAddRefed': [ '__indexedGetter' ],
-    'binaryNames': { '__indexedGetter': 'IndexedGetter' }
 },
 
 'MediaStreamTrack': {
     'concrete': False
 },
 
 'MediaRecorder': {
     'headerFile': 'MediaRecorder.h',
-    'resultNotAddRefed': [ 'stream' ]
 },
 
 'MessagePort': {
     'nativeType': 'mozilla::dom::MessagePortBase',
     'headerFile': 'mozilla/dom/MessagePort.h',
     'binaryNames': {
         'postMessage': 'postMessageMoz',
     },
 },
 
 'MimeType': {
     'headerFile' : 'nsMimeTypeArray.h',
     'nativeType': 'nsMimeType',
-    'resultNotAddRefed': [ 'enabledPlugin' ]
 },
 
 'MimeTypeArray': {
     'nativeType': 'nsMimeTypeArray',
-    'resultNotAddRefed': [ 'item', 'namedItem' ]
 },
 
 'MozCanvasPrintState': {
     'headerFile': 'mozilla/dom/HTMLCanvasElement.h',
     'nativeType': 'mozilla::dom::HTMLCanvasPrintState',
 },
 
 'MozChannel': {
@@ -843,17 +711,16 @@ DOMInterfaces = {
 },
 
 'MozMobileConnection': {
     'nativeType': 'mozilla::dom::MobileConnection',
 },
 
 'MozMobileConnectionArray': {
     'nativeType': 'mozilla::dom::MobileConnectionArray',
-    'resultNotAddRefed': [ 'item' ]
 },
 
 'MozMobileConnectionInfo': {
     'nativeType': 'mozilla::dom::MobileConnectionInfo',
 },
 
 'MozMobileMessageManager': {
     'nativeType': 'mozilla::dom::MobileMessageManager',
@@ -886,91 +753,67 @@ DOMInterfaces = {
 
 'MutationObserver': {
     'nativeType': 'nsDOMMutationObserver',
 },
 
 'MutationRecord': {
     'nativeType': 'nsDOMMutationRecord',
     'headerFile': 'nsDOMMutationObserver.h',
-    'resultNotAddRefed': [ 'target', 'addedNodes', 'removedNodes',
-                           'previousSibling', 'nextSibling' ]
 },
 
 'NamedNodeMap': {
     'nativeType': 'nsDOMAttributeMap',
 },
 
 'NetworkInformation': {
     'nativeType': 'mozilla::dom::network::Connection',
 },
 
 'Node': {
     'nativeType': 'nsINode',
     'concrete': False,
-    'resultNotAddRefed': [ 'ownerDocument', 'parentNode', 'parentElement',
-                           'childNodes', 'firstChild', 'lastChild',
-                           'previousSibling', 'nextSibling', 'insertBefore',
-                           'appendChild', 'replaceChild', 'removeChild',
-                           'attributes' ],
     'binaryNames': {
         'baseURI': 'baseURIFromJS'
     }
 },
 
 'NodeIterator': {
     'wrapperCache': False,
-    'resultNotAddRefed': [ 'root', 'referenceNode' ],
 },
 
 'NodeList': {
     'nativeType': 'nsINodeList',
-    'resultNotAddRefed': [ 'item' ]
-},
-
-'OfflineAudioCompletionEvent': {
-    'resultNotAddRefed': [ 'renderedBuffer' ],
 },
 
 'OfflineAudioContext': {
     'nativeType': 'mozilla::dom::AudioContext',
-    'resultNotAddRefed': [ 'destination', 'listener' ],
 },
 
 'OfflineResourceList': {
     'nativeType': 'nsDOMOfflineResourceList',
 },
 
-'OscillatorNode': {
-    'resultNotAddRefed': [ 'frequency', 'detune' ],
-},
-
 'PaintRequestList': {
     'headerFile': 'mozilla/dom/PaintRequest.h',
-    'resultNotAddRefed': [ 'item' ]
-},
-
-'PannerNode': {
-    'resultNotAddRefed': [ 'coneGain', 'distanceGain' ],
 },
 
 'Path2D': {
     'nativeType': 'mozilla::dom::CanvasPath',
     'headerFile': 'CanvasRenderingContext2D.h'
 },
 
 'PeerConnectionImpl': {
     'nativeType': 'sipcc::PeerConnectionImpl',
     'headerFile': 'PeerConnectionImpl.h',
     'wrapperCache': False
 },
 
 'Performance': [{
     'nativeType': 'nsPerformance',
-    'resultNotAddRefed': [ 'timing', 'navigation' ]
 },
 {
     'nativeType': 'mozilla::dom::workers::Performance',
     'headerFile': 'mozilla/dom/workers/bindings/Performance.h',
     'workers': True,
 }],
 
 'PerformanceTiming': {
@@ -981,22 +824,20 @@ DOMInterfaces = {
 'PerformanceNavigation': {
     'nativeType': 'nsPerformanceNavigation',
     'headerFile': 'nsPerformance.h'
 },
 
 'Plugin': {
     'headerFile' : 'nsPluginArray.h',
     'nativeType': 'nsPluginElement',
-    'resultNotAddRefed': [ 'item', 'namedItem' ]
 },
 
 'PluginArray': {
     'nativeType': 'nsPluginArray',
-    'resultNotAddRefed': [ 'item', 'namedItem' ]
 },
 
 'Position': {
     'headerFile': 'nsGeoPosition.h'
 },
 
 'PositionError': {
     'headerFile': 'nsGeolocation.h'
@@ -1007,61 +848,37 @@ DOMInterfaces = {
 },
 
 'PromiseDebugging': {
     'concrete': False,
 },
 
 'PropertyNodeList': {
     'headerFile': 'HTMLPropertiesCollection.h',
-    'resultNotAddRefed': [ 'item' ]
 },
 
 'Range': {
     'nativeType': 'nsRange',
-    'resultNotAddRefed': [ 'startContainer', 'endContainer', 'commonAncestorContainer' ],
     'binaryNames': {
         '__stringifier': 'ToString'
     }
 },
 
 'Rect': {
     'nativeType': 'nsDOMCSSRect',
-    'resultNotAddRefed': [ 'top', 'right', 'bottom', 'left' ]
 },
 
 'RGBColor': {
     'nativeType': 'nsDOMCSSRGBColor',
-    'resultNotAddRefed': [ 'alpha', 'blue', 'green', 'red' ]
-},
-
-'RsaHashedKeyAlgorithm': {
-    'resultNotAddRefed': ['hash']
 },
 
 'Screen': {
     'nativeType': 'nsScreen',
 },
 
-'Selection': {
-    'resultNotAddRefed': [ 'anchorNode', 'focusNode', 'getRangeAt' ],
-},
-
-'ShadowRoot': {
-    'resultNotAddRefed': [
-        'styleSheets'
-    ]
-},
-
-'HTMLShadowElement': {
-    'resultNotAddRefed': [
-        'getOldShadowRoot'
-    ]
-},
-
 'ServiceWorker': {
     'nativeType': 'mozilla::dom::workers::ServiceWorker',
     'headerFile': 'mozilla/dom/workers/bindings/ServiceWorker.h',
 },
 
 'ServiceWorkerGlobalScope': {
     'headerFile': 'mozilla/dom/WorkerScope.h',
     'workers': True,
@@ -1073,20 +890,16 @@ DOMInterfaces = {
     'implicitJSContext': [ 'constructor' ],
 },
 
 'SharedWorkerGlobalScope': {
     'headerFile': 'mozilla/dom/WorkerScope.h',
     'workers': True,
 },
 
-'SourceBufferList': {
-    'resultNotAddRefed': [ '__indexedGetter' ],
-},
-
 'Storage': {
     'nativeType': 'mozilla::dom::DOMStorage',
 },
 
 'StyleSheet': {
     'nativeType': 'mozilla::CSSStyleSheet',
 },
 
@@ -1101,27 +914,25 @@ DOMInterfaces = {
 },
 
 'SVGAnimatedPreserveAspectRatio': {
     'nativeType': 'mozilla::dom::DOMSVGAnimatedPreserveAspectRatio',
     'headerFile': 'SVGAnimatedPreserveAspectRatio.h'
 },
 
 'SVGAnimationElement': {
-    'resultNotAddRefed': ['targetElement'],
     'concrete': False
 },
 
 'SVGComponentTransferFunctionElement': {
     'concrete': False,
 },
 
 'SVGElement': {
     'nativeType': 'nsSVGElement',
-    'resultNotAddRefed': ['ownerSVGElement', 'viewportElement', 'style']
 },
 
 'SVGFEFuncAElement': {
     'headerFile': 'mozilla/dom/SVGComponentTransferFunctionElement.h',
 },
 
 'SVGFEFuncBElement': {
     'headerFile': 'mozilla/dom/SVGComponentTransferFunctionElement.h',
@@ -1132,17 +943,16 @@ DOMInterfaces = {
 },
 
 'SVGFEFuncRElement': {
     'headerFile': 'mozilla/dom/SVGComponentTransferFunctionElement.h',
 },
 
 'SVGGraphicsElement': {
     'concrete': False,
-    'resultNotAddRefed': ['nearestViewportElement', 'farthestViewportElement']
 },
 
 'SVGGradientElement': {
     'concrete': False,
 },
 
 'SVGLength': {
     'nativeType': 'mozilla::DOMSVGLength',
@@ -1301,36 +1111,31 @@ DOMInterfaces = {
     'concrete': False
 },
 
 'SVGTextPositioningElement': {
     'concrete': False
 },
 
 'SVGTransform': {
-    'resultNotAddRefed': [ 'matrix' ],
     'binaryNames': {
         "matrix": "GetMatrix"
     }
 },
 
 'SVGTransformList': {
     'nativeType': 'mozilla::DOMSVGTransformList',
     'headerFile': 'DOMSVGTransformList.h'
 },
 
 'SVGStringList': {
     'nativeType': 'mozilla::DOMSVGStringList',
     'headerFile': 'DOMSVGStringList.h',
 },
 
-'SVGSVGElement': {
-    'resultNotAddRefed': [ 'getElementById' ]
-},
-
 'SVGUnitTypes' : {
     'concrete': False,
 },
 
 'SVGZoomAndPan' : {
     'concrete': False,
 },
 
@@ -1361,17 +1166,16 @@ DOMInterfaces = {
 },
 
 'TreeColumns': {
     'nativeType': 'nsTreeColumns',
 },
 
 'TreeWalker': {
     'wrapperCache': False,
-    'resultNotAddRefed': [ 'root', 'currentNode' ],
 },
 
 'UndoManager': {
     'implicitJSContext' : [ 'undo', 'redo', 'transact' ],
 },
 
 'URL' : [{
     'wrapperCache': False,
@@ -1538,24 +1342,22 @@ DOMInterfaces = {
 'WebGLRenderbuffer': {
     'nativeType': 'mozilla::WebGLRenderbuffer',
     'headerFile': 'WebGLRenderbuffer.h'
 },
 
 'WebGLRenderingContext': {
     'nativeType': 'mozilla::WebGLContext',
     'headerFile': 'WebGLContext.h',
-    'resultNotAddRefed': [ 'canvas', 'getContextAttributes', 'getExtension' ],
     'implicitJSContext': [ 'getSupportedExtensions' ],
 },
 
 'WebGL2RenderingContext': {
     'nativeType': 'mozilla::WebGLContext',
     'headerFile': 'WebGLContext.h',
-    'resultNotAddRefed': [ 'canvas', 'getContextAttributes', 'getExtension' ],
     'implicitJSContext': [ 'getSupportedExtensions' ],
 },
 
 'WebGLShader': {
     'nativeType': 'mozilla::WebGLShader',
     'headerFile': 'WebGLShader.h'
 },
 
@@ -1643,26 +1445,19 @@ DOMInterfaces = {
     'workers': True,
     'implicitJSContext': ['getDataStores'],
 },
 
 'XMLHttpRequest': [
 {
     'nativeType': 'nsXMLHttpRequest',
     'implicitJSContext': [ 'constructor', ],
-    'resultNotAddRefed': [ 'upload', 'responseXML' ]
 },
 {
     'workers': True,
-    # XXXkhuey responseXML returns Document? which boils down to a JSObject*
-    # on a worker, and nsRefPtr<JSObject> fails in the expected way. channel is
-    # similar.  This is ugly but it's all going away soon anyways.
-    'resultNotAddRefed': [
-        'responseXML', 'channel'
-    ]
 }],
 
 'XMLHttpRequestEventTarget': {
     'nativeType': 'nsXHREventTarget',
     'headerFile': 'nsXMLHttpRequest.h',
     'concrete': False
 },
 
@@ -1674,55 +1469,41 @@ DOMInterfaces = {
 {
     'workers': True,
 }],
 
 'XMLSerializer': {
     'nativeType': 'nsDOMSerializer',
 },
 
-'XMLStylesheetProcessingInstruction': {
-    'resultNotAddRefed': [ 'sheet' ]
-},
-
 'XPathEvaluator': {
     'wrapperCache': False
 },
 
-'XPathResult': {
-    'resultNotAddRefed': ['singleNodeValue', 'iterateNext', 'snapshotItem']
-},
-
 'XPathExpression': {
     'wrapperCache': False,
     'nativeOwnership': 'owned',
 },
 
 'XULDocument': {
     'headerFile': 'XULDocument.h'
 },
 
 'XULElement': {
     'nativeType': 'nsXULElement',
-    'resultNotAddRefed': [ 'controllers', 'style' ]
 },
 
 ####################################
 # Test Interfaces of various sorts #
 ####################################
 
 'TestInterface' : {
         # Keep this in sync with TestExampleInterface
         'headerFile': 'TestBindingHeader.h',
         'register': False,
-        'resultNotAddRefed': [ 'receiveWeakSelf', 'receiveWeakNullableSelf',
-                               'receiveWeakOther', 'receiveWeakNullableOther',
-                               'receiveWeakExternal', 'receiveWeakNullableExternal',
-                               'ReceiveWeakCallbackInterface',
-                               'ReceiveWeakNullableCallbackInterface' ],
         'binaryNames': { 'methodRenamedFrom': 'methodRenamedTo',
                          'attributeGetterRenamedFrom': 'attributeGetterRenamedTo',
                          'attributeRenamedFrom': 'attributeRenamedTo' }
         },
 
 'TestParentInterface' : {
         'headerFile': 'TestBindingHeader.h',
         'register': False,
@@ -1742,21 +1523,16 @@ DOMInterfaces = {
         'headerFile': 'TestCImplementedInterface.h',
         'register': False,
         },
 
 'TestJSImplInterface' : {
         # Keep this in sync with TestExampleInterface
         'headerFile': 'TestJSImplGenBinding.h',
         'register': False,
-        'resultNotAddRefed': [ 'receiveWeakSelf', 'receiveWeakNullableSelf',
-                               'receiveWeakOther', 'receiveWeakNullableOther',
-                               'receiveWeakExternal', 'receiveWeakNullableExternal',
-                               'ReceiveWeakCallbackInterface',
-                               'ReceiveWeakNullableCallbackInterface' ],
         'binaryNames': { 'methodRenamedFrom': 'methodRenamedTo',
                          'attributeGetterRenamedFrom': 'attributeGetterRenamedTo',
                          'attributeRenamedFrom': 'attributeRenamedTo' }
         },
 
 'TestJSImplInterface2' : {
         'headerFile': 'TestJSImplGenBinding.h',
         'register': False
@@ -1933,21 +1709,16 @@ DOMInterfaces = {
         'headerFile': 'TestBindingHeader.h',
         'register': False
         },
 
 'TestExampleInterface' : {
         # Keep this in sync with TestInterface
         'headerFile': 'TestExampleInterface-example.h',
         'register': False,
-        'resultNotAddRefed': [ 'receiveWeakSelf', 'receiveWeakNullableSelf',
-                               'receiveWeakOther', 'receiveWeakNullableOther',
-                               'receiveWeakExternal', 'receiveWeakNullableExternal',
-                               'ReceiveWeakCallbackInterface',
-                               'ReceiveWeakNullableCallbackInterface' ],
         'binaryNames': { 'methodRenamedFrom': 'methodRenamedTo',
                          'attributeGetterRenamedFrom': 'attributeGetterRenamedTo',
                          'attributeRenamedFrom': 'attributeRenamedTo' }
         },
 
 'TestExampleProxyInterface' : {
         'headerFile': 'TestExampleProxyInterface-example.h',
         'register': False
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -5916,17 +5916,16 @@ def typeMatchesLambda(type, func):
 def dictionaryMatchesLambda(dictionary, func):
     return (any(typeMatchesLambda(m.type, func) for m in dictionary.members) or
             (dictionary.parent and dictionaryMatchesLambda(dictionary.parent, func)))
 
 
 # Whenever this is modified, please update CGNativeMember.getRetvalInfo as
 # needed to keep the types compatible.
 def getRetvalDeclarationForType(returnType, descriptorProvider,
-                                resultAlreadyAddRefed,
                                 isMember=False):
     """
     Returns a tuple containing five things:
 
     1) A CGThing for the type of the return value, or None if there is no need
        for a return value.
 
     2) A value indicating the kind of ourparam to pass the value as.  Valid
@@ -5985,41 +5984,35 @@ def getRetvalDeclarationForType(returnTy
     if returnType.isObject() or returnType.isSpiderMonkeyInterface():
         if isMember:
             return CGGeneric("JSObject*"), None, None, None, None
         return CGGeneric("JS::Rooted<JSObject*>"), "ptr", None, "cx", None
     if returnType.isSequence():
         nullable = returnType.nullable()
         if nullable:
             returnType = returnType.inner
-        # If our result is already addrefed, use the right type in the
-        # sequence argument here.
         result, _, _, _, _ = getRetvalDeclarationForType(returnType.inner,
                                                          descriptorProvider,
-                                                         resultAlreadyAddRefed,
                                                          isMember="Sequence")
         # While we have our inner type, set up our rooter, if needed
         if not isMember and typeNeedsRooting(returnType):
             rooter = CGGeneric("SequenceRooter<%s > resultRooter(cx, &result);\n" %
                                result.define())
         else:
             rooter = None
         result = CGTemplatedType("nsTArray", result)
         if nullable:
             result = CGTemplatedType("Nullable", result)
         return result, "ref", rooter, None, None
     if returnType.isMozMap():
         nullable = returnType.nullable()
         if nullable:
             returnType = returnType.inner
-        # If our result is already addrefed, use the right type in the
-        # MozMap argument here.
         result, _, _, _, _ = getRetvalDeclarationForType(returnType.inner,
                                                          descriptorProvider,
-                                                         resultAlreadyAddRefed,
                                                          isMember="MozMap")
         # While we have our inner type, set up our rooter, if needed
         if not isMember and typeNeedsRooting(returnType):
             rooter = CGGeneric("MozMapRooter<%s> resultRooter(cx, &result);\n" %
                                result.define())
         else:
             rooter = None
         result = CGTemplatedType("MozMap", result)
@@ -6058,20 +6051,16 @@ def getRetvalDeclarationForType(returnTy
         result = CGGeneric("Date")
         if returnType.nullable():
             result = CGTemplatedType("Nullable", result)
         return result, None, None, None, None
     raise TypeError("Don't know how to declare return value for %s" %
                     returnType)
 
 
-def isResultAlreadyAddRefed(extendedAttributes):
-    return 'resultNotAddRefed' not in extendedAttributes
-
-
 def needCx(returnType, arguments, extendedAttributes, considerTypes,
            static=False):
     return (not static and considerTypes and
             (typeNeedsCx(returnType, True) or
              any(typeNeedsCx(a.type) for a in arguments)) or
             'implicitJSContext' in extendedAttributes)
 
 
@@ -6103,20 +6092,18 @@ class CGCallGenerator(CGThing):
                  extendedAttributes, descriptorProvider, nativeMethodName,
                  static, object="self", argsPost=[], resultVar=None):
         CGThing.__init__(self)
 
         assert errorReport is None or isinstance(errorReport, CGThing)
 
         isFallible = errorReport is not None
 
-        resultAlreadyAddRefed = isResultAlreadyAddRefed(extendedAttributes)
         result, resultOutParam, resultRooter, resultArgs, resultConversion = \
-            getRetvalDeclarationForType(
-                returnType, descriptorProvider, resultAlreadyAddRefed)
+            getRetvalDeclarationForType(returnType, descriptorProvider)
 
         args = CGList([CGGeneric(arg) for arg in argsPre], ", ")
         for a, name in arguments:
             arg = CGGeneric(name)
 
             # Now constify the things that need it
             def needsConst(a):
                 if a.type.isDictionary():
@@ -7720,20 +7707,18 @@ class CGSpecializedGetter(CGAbstractStat
         return (prefix +
                 CGGetterCall(self.attr.type, nativeName,
                              self.descriptor, self.attr).define())
 
     @staticmethod
     def makeNativeName(descriptor, attr):
         name = attr.identifier.name
         nativeName = MakeNativeName(descriptor.binaryNameFor(name))
-        # resultOutParam does not depend on whether resultAlreadyAddRefed is set
         _, resultOutParam, _, _, _ = getRetvalDeclarationForType(attr.type,
-                                                                 descriptor,
-                                                                 False)
+                                                                 descriptor)
         infallible = ('infallible' in
                       descriptor.getExtendedAttributes(attr, getter=True))
         if resultOutParam or attr.type.nullable() or not infallible:
             nativeName = "Get" + nativeName
         return nativeName
 
 
 class CGStaticGetter(CGAbstractStaticBindingMethod):
@@ -12156,30 +12141,31 @@ class CGBindingRoot(CGThing):
 
     def deps(self):
         return self.root.deps()
 
 
 class CGNativeMember(ClassMethod):
     def __init__(self, descriptorProvider, member, name, signature, extendedAttrs,
                  breakAfter=True, passJSBitsAsNeeded=True, visibility="public",
-                 typedArraysAreStructs=True, variadicIsSequence=False):
+                 typedArraysAreStructs=True, variadicIsSequence=False,
+                 resultNotAddRefed=False):
         """
         If typedArraysAreStructs is false, typed arrays will be passed as
         JS::Handle<JSObject*>.  If it's true they will be passed as one of the
         dom::TypedArray subclasses.
 
         If passJSBitsAsNeeded is false, we don't automatically pass in a
         JSContext* or a JSObject* based on the return and argument types.  We
         can still pass it based on 'implicitJSContext' annotations.
         """
         self.descriptorProvider = descriptorProvider
         self.member = member
         self.extendedAttrs = extendedAttrs
-        self.resultAlreadyAddRefed = isResultAlreadyAddRefed(self.extendedAttrs)
+        self.resultAlreadyAddRefed = not resultNotAddRefed
         self.passJSBitsAsNeeded = passJSBitsAsNeeded
         self.typedArraysAreStructs = typedArraysAreStructs
         self.variadicIsSequence = variadicIsSequence
         breakAfterSelf = "\n" if breakAfter else ""
         ClassMethod.__init__(self, name,
                              self.getReturnType(signature[0], False),
                              self.getArgs(signature[0], signature[1]),
                              static=member.isStatic(),
@@ -14297,23 +14283,22 @@ class GlobalGenRoots():
         curr = CGIncludeGuard('FeatureList', curr)
 
         return curr
 
 # Code generator for simple events
 class CGEventGetter(CGNativeMember):
     def __init__(self, descriptor, attr):
         ea = descriptor.getExtendedAttributes(attr, getter=True)
-        if not attr.type.isSequence():
-            ea.append('resultNotAddRefed')
         CGNativeMember.__init__(self, descriptor, attr,
                                 CGSpecializedGetter.makeNativeName(descriptor,
                                                                    attr),
                                 (attr.type, []),
-                                ea)
+                                ea,
+                                resultNotAddRefed=not attr.type.isSequence())
         self.body = self.getMethodBody()
 
     def getArgs(self, returnType, argList):
         if 'infallible' not in self.extendedAttrs:
             raise TypeError("Event code generator does not support [Throws]!")
         if not self.member.isAttr():
             raise TypeError("Event code generator does not support methods")
         if self.member.isStatic():
--- a/dom/bindings/Configuration.py
+++ b/dom/bindings/Configuration.py
@@ -409,17 +409,17 @@ class Descriptor(DescriptorProvider):
                         add('all', map(lambda m: m.name, iface.members), attribute)
                         iface = iface.parent
                 else:
                     add('all', [config], attribute)
 
         if self.interface.isJSImplemented():
             addExtendedAttribute('implicitJSContext', ['constructor'])
         else:
-            for attribute in ['implicitJSContext', 'resultNotAddRefed']:
+            for attribute in ['implicitJSContext']:
                 addExtendedAttribute(attribute, desc.get(attribute, {}))
 
         self._binaryNames = desc.get('binaryNames', {})
         self._binaryNames.setdefault('__legacycaller', 'LegacyCall')
         self._binaryNames.setdefault('__stringifier', 'Stringify')
 
         if not self.interface.isExternal():
             self.permissions = dict()