Bug 834877 part 2. Start using DOMString as the return value for strings. r=peterv
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 29 Jan 2013 09:42:14 -0500
changeset 130095 c4209fe94d301cfe22d74f3e3b06d7161f94e469
parent 130094 6a158459ea7d0eddcb93c58d29561c94ca23ee54
child 130096 9ed387b675bb030f4521074fc7b46410c1a06271
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs834877
milestone21.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 834877 part 2. Start using DOMString as the return value for strings. r=peterv
dom/bindings/Codegen.py
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -3537,27 +3537,30 @@ def typeNeedsCx(type, descriptorProvider
 
 # Returns a tuple consisting of a CGThing containing the type of the return
 # value, or None if there is no need for a return value, and a boolean signaling
 # whether the return value is passed in an out parameter.
 #
 # Whenever this is modified, please update CGNativeMember.getRetvalInfo as
 # needed
 def getRetvalDeclarationForType(returnType, descriptorProvider,
-                                resultAlreadyAddRefed):
+                                resultAlreadyAddRefed,
+                                isMember=False):
     if returnType is None or returnType.isVoid():
         # Nothing to declare
         return None, False
     if returnType.isPrimitive() and returnType.tag() in builtinNames:
         result = CGGeneric(builtinNames[returnType.tag()])
         if returnType.nullable():
             result = CGWrapper(result, pre="Nullable<", post=">")
         return result, False
     if returnType.isString():
-        return CGGeneric("nsString"), True
+        if isMember:
+            return CGGeneric("nsString"), True
+        return CGGeneric("DOMString"), True
     if returnType.isEnum():
         if returnType.nullable():
             raise TypeError("We don't support nullable enum return values")
         return CGGeneric(returnType.inner.identifier.name), False
     if returnType.isGeckoInterface():
         result = CGGeneric(descriptorProvider.getDescriptor(
             returnType.unroll().inner.identifier.name).nativeType)
         if resultAlreadyAddRefed:
@@ -3577,17 +3580,18 @@ def getRetvalDeclarationForType(returnTy
     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)
+                                                  resultAlreadyAddRefed,
+                                                  isMember=True)
         result = CGWrapper(result, pre="nsTArray< ", post=" >")
         if nullable:
             result = CGWrapper(result, pre="Nullable< ", post=" >")
         return result, True
     if returnType.isDictionary():
         nullable = returnType.nullable()
         result = CGGeneric(
             CGDictionary.makeDictionaryName(returnType.unroll().inner,