Bug 778150 part 1. Remove the vestigial ability to specify infallibility stuff in the conf file. r=peterv
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 05 Sep 2012 09:21:33 -0400
changeset 104293 d625d938c36d990145f725a9812038064b9ff47c
parent 104292 20e483ab67ae724e6a7493c84d4af17a73bec804
child 104294 5cb9f5f29ead62694ba995724905928c2e4593cd
push id23417
push userryanvm@gmail.com
push dateThu, 06 Sep 2012 02:27:31 +0000
treeherdermozilla-central@501f4e46a88c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs778150
milestone18.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 778150 part 1. Remove the vestigial ability to specify infallibility stuff in the conf file. r=peterv
dom/bindings/Bindings.conf
dom/bindings/Codegen.py
dom/bindings/Configuration.py
dom/bindings/test/TestCodeGen.webidl
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -291,29 +291,27 @@ DOMInterfaces = {
 'OnlyForUseInConstructor' : {
         'headerFile': 'TestBindingHeader.h',
         'register': False
         },
 
 
 'TestIndexedGetterInterface' : {
         'headerFile': 'TestBindingHeader.h',
-        'register': False,
-        'infallible': [ 'length' ]
+        'register': False
         },
 
 'TestNamedGetterInterface' : {
         'headerFile': 'TestBindingHeader.h',
         'register': False
         },
 
 'TestIndexedAndNamedGetterInterface' : {
         'headerFile': 'TestBindingHeader.h',
-        'register': False,
-        'infallible': [ 'length' ]
+        'register': False
         },
 
 'TestIndexedSetterInterface' : {
         'headerFile': 'TestBindingHeader.h',
         'register': False
         },
 
 'TestNamedSetterInterface' : {
@@ -324,17 +322,16 @@ DOMInterfaces = {
 'TestIndexedAndNamedSetterInterface' : {
         'headerFile': 'TestBindingHeader.h',
         'register': False
         },
 
 'TestIndexedAndNamedGetterAndSetterInterface' : {
         'headerFile': 'TestBindingHeader.h',
         'register': False,
-        'infallible': [ 'length', '__stringifier' ],
         'binaryNames': { '__stringifier': 'Stringify' }
         },
 }
 
 # These are temporary, until they've been converted to use new DOM bindings
 def addExternalIface(iface, nativeType=None, headerFile=None):
     domInterface = {
         'concrete': False
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -2833,22 +2833,27 @@ def getRetvalDeclarationForType(returnTy
 def isResultAlreadyAddRefed(descriptor, extendedAttributes):
     # Default to already_AddRefed on the main thread, raw pointer in workers
     return not descriptor.workers and not 'resultNotAddRefed' in extendedAttributes
 
 class CGCallGenerator(CGThing):
     """
     A class to generate an actual call to a C++ object.  Assumes that the C++
     object is stored in a variable whose name is given by the |object| argument.
+
+    errorReport should be a CGThing for an error report or None if no
+    error reporting is needed.
     """
     def __init__(self, errorReport, arguments, argsPre, returnType,
                  extendedAttributes, descriptorProvider, nativeMethodName,
                  static, object="self", declareResult=True):
         CGThing.__init__(self)
 
+        assert errorReport is None or isinstance(errorReport, CGThing)
+
         isFallible = errorReport is not None
 
         resultAlreadyAddRefed = isResultAlreadyAddRefed(descriptorProvider,
                                                         extendedAttributes)
         (result, resultOutParam) = getRetvalDeclarationForType(returnType,
                                                                descriptorProvider,
                                                                resultAlreadyAddRefed)
 
@@ -4820,18 +4825,19 @@ class CGDOMJSProxyHandler_obj_toString(C
         if stringifier:
             name = stringifier.identifier.name
             nativeName = MakeNativeName(self.descriptor.binaryNames.get(name, name))
             signature = stringifier.signatures()[0]
             returnType = signature[0]
             extendedAttributes = self.descriptor.getExtendedAttributes(stringifier)
             infallible = 'infallible' in extendedAttributes
             if not infallible:
-                error = ('ThrowMethodFailedWithDetails(cx, rv, "%s", "toString")\n' +
-                         "return NULL;") % self.descriptor.interface.identifier.name
+                error = CGGeneric(
+                    ('ThrowMethodFailedWithDetails(cx, rv, "%s", "toString");\n' +
+                     "return NULL;") % self.descriptor.interface.identifier.name)
             else:
                 error = None
             call = CGCallGenerator(error, [], "", returnType, extendedAttributes, self.descriptor, nativeName, False, object="UnwrapProxy(proxy)")
             return call.define() + """
 
 JSString* jsresult;
 return xpc_qsStringToJsstring(cx, result, &jsresult) ? jsresult : NULL;""" 
 
--- a/dom/bindings/Configuration.py
+++ b/dom/bindings/Configuration.py
@@ -260,17 +260,17 @@ class Descriptor(DescriptorProvider):
                 if config == '*':
                     iface = self.interface
                     while iface:
                         add('all', map(lambda m: m.name, iface.members), attribute)
                         iface = iface.parent
                 else:
                     add('all', [config], attribute)
 
-        for attribute in ['infallible', 'implicitJSContext', 'resultNotAddRefed']:
+        for attribute in ['implicitJSContext', 'resultNotAddRefed']:
             addExtendedAttribute(attribute, desc.get(attribute, {}))
 
         self.binaryNames = desc.get('binaryNames', {})
 
         # Build the prototype chain.
         self.prototypeChain = []
         parent = interface
         while parent:
--- a/dom/bindings/test/TestCodeGen.webidl
+++ b/dom/bindings/test/TestCodeGen.webidl
@@ -371,26 +371,28 @@ dictionary ParentDict : GrandparentDict 
 };
 
 dictionary DictContainingDict {
   Dict memberDict;
 };
 
 interface TestIndexedGetterInterface {
   getter long item(unsigned long index);
+  [Infallible]
   readonly attribute unsigned long length;
 };
 
 interface TestNamedGetterInterface {
   getter DOMString (DOMString name);
 };
 
 interface TestIndexedAndNamedGetterInterface {
   getter long (unsigned long index);
   getter DOMString namedItem(DOMString name);
+  [Infallible]
   readonly attribute unsigned long length;
 };
 
 interface TestIndexedSetterInterface {
   setter creator void setItem(unsigned long index, DOMString item);
 };
 
 interface TestNamedSetterInterface {
@@ -402,11 +404,13 @@ interface TestIndexedAndNamedSetterInter
   setter creator void setNamedItem(DOMString name, TestIndexedSetterInterface item);
 };
 
 interface TestIndexedAndNamedGetterAndSetterInterface : TestIndexedSetterInterface {
   getter long item(unsigned long index);
   getter DOMString namedItem(DOMString name);
   setter creator void (unsigned long index, long item);
   setter creator void (DOMString name, DOMString item);
+  [Infallible]
   stringifier DOMString ();
+  [Infallible]
   readonly attribute unsigned long length;
 };