From 23f412b30d0e5e7ab8d1f11f5e66eaa18c712f33 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 15 Oct 2014 13:17:06 -0400 Subject: [PATCH] Backed out changeset 8d198ef0b559 (bug 1082583) for test_headers.html failures. CLOSED TREE --- dom/bindings/Codegen.py | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index e43b9ab056e2..22b5d0346525 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -3907,8 +3907,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, lenientFloatCode=None, allowTreatNonCallableAsNull=False, isCallbackReturnValue=False, - sourceDescription="value", - nestingLevel=""): + sourceDescription="value"): """ Get a template for converting a JS value to a native object based on the given type and descriptor. If failureCode is given, then we're actually @@ -4111,9 +4110,6 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, dealWithOptional=isOptional, declArgs=declArgs) - def incrementNestingLevel(): - return 1 if nestingLevel is "" else ++nestingLevel - assert not (isEnforceRange and isClamp) # These are mutually exclusive if type.isArray(): @@ -4161,8 +4157,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, elementType, descriptorProvider, isMember="Sequence", exceptionCode=exceptionCode, lenientFloatCode=lenientFloatCode, isCallbackReturnValue=isCallbackReturnValue, - sourceDescription="element of %s" % sourceDescription, - nestingLevel=incrementNestingLevel()) + sourceDescription="element of %s" % sourceDescription) if elementInfo.dealWithOptional: raise TypeError("Shouldn't have optional things in sequences") if elementInfo.holderType is not None: @@ -4177,41 +4172,41 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, arrayRef = "${declName}" elementConversion = string.Template(elementInfo.template).substitute({ - "val": "temp" + str(nestingLevel), - "declName": "slot" + str(nestingLevel), + "val": "temp", + "declName": "slot", # We only need holderName here to handle isExternal() # interfaces, which use an internal holder for the # conversion even when forceOwningType ends up true. - "holderName": "tempHolder" + str(nestingLevel), + "holderName": "tempHolder", "passedToJSImpl": "${passedToJSImpl}" }) # NOTE: Keep this in sync with variadic conversions as needed templateBody = fill( """ - JS::ForOfIterator iter${nestingLevel}(cx); - if (!iter${nestingLevel}.init($${val}, JS::ForOfIterator::AllowNonIterable)) { + JS::ForOfIterator iter(cx); + if (!iter.init($${val}, JS::ForOfIterator::AllowNonIterable)) { $*{exceptionCode} } - if (!iter${nestingLevel}.valueIsIterable()) { + if (!iter.valueIsIterable()) { $*{notSequence} } - ${sequenceType} &arr${nestingLevel} = ${arrayRef}; - JS::Rooted temp${nestingLevel}(cx); + ${sequenceType} &arr = ${arrayRef}; + JS::Rooted temp(cx); while (true) { bool done; - if (!iter${nestingLevel}.next(&temp, &done)) { + if (!iter.next(&temp, &done)) { $*{exceptionCode} } if (done) { break; } - ${elementType}* slotPtr${nestingLevel} = arr${nestingLevel}.AppendElement(); - if (!slotPtr${nestingLevel}) { + ${elementType}* slotPtr = arr.AppendElement(); + if (!slotPtr) { JS_ReportOutOfMemory(cx); $*{exceptionCode} } - ${elementType}& slot${nestingLevel} = *slotPtr${nestingLevel}; + ${elementType}& slot = *slotPtr; $*{elementConversion} } """, @@ -4220,8 +4215,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, sequenceType=sequenceType, arrayRef=arrayRef, elementType=elementInfo.declType.define(), - elementConversion=elementConversion, - nestingLevel=str(nestingLevel)) + elementConversion=elementConversion) templateBody = wrapObjectTemplate(templateBody, type, "${declName}.SetNull();\n", notSequence) @@ -4268,8 +4262,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, valueType, descriptorProvider, isMember="MozMap", exceptionCode=exceptionCode, lenientFloatCode=lenientFloatCode, isCallbackReturnValue=isCallbackReturnValue, - sourceDescription="value in %s" % sourceDescription, - nestingLevel=incrementNestingLevel()) + sourceDescription="value in %s" % sourceDescription) if valueInfo.dealWithOptional: raise TypeError("Shouldn't have optional things in MozMap") if valueInfo.holderType is not None: