Bug 1468273 - Fix flake8/pep8 issue by hand in dom/ r?bz draft
authorSylvestre Ledru <sledru@mozilla.com>
Thu, 12 Jul 2018 12:11:18 +0200
changeset 818793 79b16b30c8c5edc553e0ce83d0b268294439deb1
parent 818792 e015caf118037907f5ca2294156327bc4feda6ff
child 818794 5c7bbe1357a21b321c927e02531f2533b82ce488
push id116340
push userbmo:sledru@mozilla.com
push dateMon, 16 Jul 2018 15:05:50 +0000
reviewersbz
bugs1468273
milestone63.0a1
Bug 1468273 - Fix flake8/pep8 issue by hand in dom/ r?bz MozReview-Commit-ID: FrnfSqVDqiR
dom/base/gen-usecounters.py
dom/base/usecounters.py
dom/bindings/Codegen.py
dom/bindings/Configuration.py
dom/bindings/mozwebidlcodegen/__init__.py
dom/bindings/parser/WebIDL.py
dom/bindings/parser/tests/test_any_null.py
dom/bindings/parser/tests/test_argument_identifier_conflicts.py
dom/bindings/parser/tests/test_argument_novoid.py
dom/bindings/parser/tests/test_arraybuffer.py
dom/bindings/parser/tests/test_attr.py
dom/bindings/parser/tests/test_attr_sequence_type.py
dom/bindings/parser/tests/test_builtin_filename.py
dom/bindings/parser/tests/test_builtins.py
dom/bindings/parser/tests/test_bytestring.py
dom/bindings/parser/tests/test_callback.py
dom/bindings/parser/tests/test_callback_interface.py
dom/bindings/parser/tests/test_cereactions.py
dom/bindings/parser/tests/test_conditional_dictionary_member.py
dom/bindings/parser/tests/test_const.py
dom/bindings/parser/tests/test_constructor.py
dom/bindings/parser/tests/test_constructor_no_interface_object.py
dom/bindings/parser/tests/test_deduplicate.py
dom/bindings/parser/tests/test_dictionary.py
dom/bindings/parser/tests/test_distinguishability.py
dom/bindings/parser/tests/test_double_null.py
dom/bindings/parser/tests/test_duplicate_qualifiers.py
dom/bindings/parser/tests/test_empty_enum.py
dom/bindings/parser/tests/test_empty_sequence_default_value.py
dom/bindings/parser/tests/test_enum.py
dom/bindings/parser/tests/test_enum_duplicate_values.py
dom/bindings/parser/tests/test_error_colno.py
dom/bindings/parser/tests/test_error_lineno.py
dom/bindings/parser/tests/test_exposed_extended_attribute.py
dom/bindings/parser/tests/test_extended_attributes.py
dom/bindings/parser/tests/test_float_types.py
dom/bindings/parser/tests/test_forward_decl.py
dom/bindings/parser/tests/test_global_extended_attr.py
dom/bindings/parser/tests/test_identifier_conflict.py
dom/bindings/parser/tests/test_implements.py
dom/bindings/parser/tests/test_incomplete_parent.py
dom/bindings/parser/tests/test_incomplete_types.py
dom/bindings/parser/tests/test_interface.py
dom/bindings/parser/tests/test_interface_const_identifier_conflicts.py
dom/bindings/parser/tests/test_interface_identifier_conflicts_across_members.py
dom/bindings/parser/tests/test_interface_maplikesetlikeiterable.py
dom/bindings/parser/tests/test_lenientSetter.py
dom/bindings/parser/tests/test_method.py
dom/bindings/parser/tests/test_namespace.py
dom/bindings/parser/tests/test_newobject.py
dom/bindings/parser/tests/test_nullable_equivalency.py
dom/bindings/parser/tests/test_nullable_void.py
dom/bindings/parser/tests/test_optional_constraints.py
dom/bindings/parser/tests/test_overload.py
dom/bindings/parser/tests/test_promise.py
dom/bindings/parser/tests/test_prototype_ident.py
dom/bindings/parser/tests/test_putForwards.py
dom/bindings/parser/tests/test_record.py
dom/bindings/parser/tests/test_replaceable.py
dom/bindings/parser/tests/test_securecontext_extended_attribute.py
dom/bindings/parser/tests/test_special_method_signature_mismatch.py
dom/bindings/parser/tests/test_special_methods.py
dom/bindings/parser/tests/test_special_methods_uniqueness.py
dom/bindings/parser/tests/test_stringifier.py
dom/bindings/parser/tests/test_toJSON.py
dom/bindings/parser/tests/test_treatNonCallableAsNull.py
dom/bindings/parser/tests/test_typedef.py
dom/bindings/parser/tests/test_unenumerable_own_properties.py
dom/bindings/parser/tests/test_unforgeable.py
dom/bindings/parser/tests/test_union.py
dom/bindings/parser/tests/test_union_any.py
dom/bindings/parser/tests/test_union_nullable.py
dom/bindings/parser/tests/test_usvstring.py
dom/bindings/parser/tests/test_variadic_callback.py
dom/bindings/parser/tests/test_variadic_constraints.py
dom/browser-element/mochitest/createNewTest.py
dom/canvas/test/webgl-conf/checkout/conformance/ogles/process-ogles2-tests.py
dom/canvas/test/webgl-conf/checkout/deqp/build.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/builtinprecision/builtinprecision_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/draw/draw_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/fbocolorbuffer/fbocolorbuffer_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/fboinvalidate/fboinvalidate_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/fborender/fborender_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/fragmentoutput/fragmentoutput_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/framebufferblit/frambufferblit_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/primitiverestart/primitiverestart_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/shaderindexing/shaderindexing_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/shadermatrix/shadermatrix_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/shaderoperator/shaderoperator_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/shadertexturefunction/shadertexturefunction_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/texturefiltering/texturefiltering_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/textureformat/textureformat_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/textureshadow/textureshadow_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/texturespecification/texturespecification_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/texturewrap/texturewrap_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/transformfeedback/transformfeedback_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/uniformapi/uniformapi_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/uniformbuffers/uniformbuffers_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/vertexarrays/vertexarrays_test_generator.py
dom/canvas/test/webgl-conf/checkout/deqp/genHTMLfromTest.py
dom/canvas/test/webgl-conf/checkout/py/lint/lint.py
dom/canvas/test/webgl-conf/checkout/py/tex_image_test_generator.py
dom/canvas/test/webgl-conf/generate-wrappers-and-manifest.py
dom/canvas/test/webgl-conf/import.py
dom/canvas/test/webgl-mochitest/mochi-to-testcase.py
dom/encoding/encodings2arrays.py
dom/media/test/graph_latency.py
dom/security/test/csp/file_upgrade_insecure_wsh.py
dom/security/test/csp/file_websocket_self_wsh.py
dom/security/test/mixedcontentblocker/file_main_bug803225_websocket_wsh.py
dom/websocket/tests/file_websocket_basic_wsh.py
dom/websocket/tests/file_websocket_bigBlob_wsh.py
dom/websocket/tests/file_websocket_hello_wsh.py
dom/websocket/tests/file_websocket_permessage_deflate_disabled_wsh.py
dom/websocket/tests/file_websocket_permessage_deflate_params_wsh.py
dom/websocket/tests/file_websocket_permessage_deflate_rejected_wsh.py
dom/websocket/tests/file_websocket_permessage_deflate_wsh.py
dom/websocket/tests/file_websocket_wsh.py
dom/websocket/tests/websocket_hybi/file_check-binary-messages_wsh.py
--- a/dom/base/gen-usecounters.py
+++ b/dom/base/gen-usecounters.py
@@ -1,24 +1,23 @@
 #!/usr/bin/env python
 
 # 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/.
 
 from __future__ import print_function
 
-import json
 import os
 import sys
 sys.path.append(os.path.dirname(__file__))
 
 import usecounters
 
-AUTOGENERATED_WARNING_COMMENT = "/* THIS FILE IS AUTOGENERATED BY gen-usecounters.py - DO NOT EDIT */"
+AUTOGENERATED_WARNING_COMMENT = "/* THIS FILE IS AUTOGENERATED BY gen-usecounters.py - DO NOT EDIT */"  # NOQA: E501
 
 
 def generate_list(f, counters):
     def print_optional_macro_declare(name):
         print('''
 #ifndef %(name)s
 #define %(name)s(interface_, name_) // nothing
 #define DEFINED_%(name)s
@@ -37,19 +36,21 @@ def generate_list(f, counters):
 
     print_optional_macro_declare('USE_COUNTER_DOM_METHOD')
     print_optional_macro_declare('USE_COUNTER_DOM_ATTRIBUTE')
     print_optional_macro_declare('USE_COUNTER_CSS_PROPERTY')
     print_optional_macro_declare('USE_COUNTER_CUSTOM')
 
     for counter in counters:
         if counter['type'] == 'method':
-            print('USE_COUNTER_DOM_METHOD(%s, %s)' % (counter['interface_name'], counter['method_name']), file=f)
+            print('USE_COUNTER_DOM_METHOD(%s, %s)' %
+                  (counter['interface_name'], counter['method_name']), file=f)
         elif counter['type'] == 'attribute':
-            print('USE_COUNTER_DOM_ATTRIBUTE(%s, %s)' % (counter['interface_name'], counter['attribute_name']), file=f)
+            print('USE_COUNTER_DOM_ATTRIBUTE(%s, %s)' %
+                  (counter['interface_name'], counter['attribute_name']), file=f)
         elif counter['type'] == 'property':
             prop = counter['property_name']
             print('USE_COUNTER_CSS_PROPERTY(%s, %s)' % (prop, prop), file=f)
         elif counter['type'] == 'custom':
             desc = counter['desc'].replace('\\', r'\\').replace('"', r'\"')
             print('USE_COUNTER_CUSTOM(%s, "%s")' % (counter['name'], desc), file=f)
 
     print_optional_macro_undeclare('USE_COUNTER_DOM_METHOD')
@@ -73,17 +74,18 @@ enum {
   #undef CSS_PROP_LONGHAND
   #undef CSS_PROP_USE_COUNTER
   #undef CSS_PROP_PUBLIC_OR_PRIVATE
 };
 ''', file=f)
     for counter in counters:
         if counter['type'] == 'property':
             prop = counter['property_name']
-            print('#define USE_COUNTER_FOR_CSS_PROPERTY_%s eUseCounter_property_%s' % (prop, prop), file=f)
+            print('#define USE_COUNTER_FOR_CSS_PROPERTY_%s eUseCounter_property_%s' %
+                  (prop, prop), file=f)
 
 
 def use_counter_list(output_header, conf_filename):
     counters = usecounters.read_conf(conf_filename)
     generate_list(output_header, counters)
 
 
 def property_map(output_map, conf_filename):
--- a/dom/base/usecounters.py
+++ b/dom/base/usecounters.py
@@ -1,17 +1,14 @@
 # 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/.
 
-import buildconfig
 import collections
 import re
-import StringIO
-import sys
 
 
 def read_conf(conf_filename):
     # Can't read/write from a single StringIO, so make a new one for reading.
     stream = open(conf_filename, 'rU')
 
     def parse_counters(stream):
         for line_num, line in enumerate(stream):
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -6,18 +6,22 @@
 
 import os
 import re
 import string
 import math
 import textwrap
 import functools
 
-from WebIDL import BuiltinTypes, IDLBuiltinType, IDLNullValue, IDLSequenceType, IDLType, IDLAttribute, IDLInterfaceMember, IDLUndefinedValue, IDLEmptySequenceValue, IDLDictionary
-from Configuration import NoSuchDescriptorError, getTypesFromDescriptor, getTypesFromDictionary, getTypesFromCallback, getAllTypes, Descriptor, MemberIsUnforgeable, iteratorNativeType
+from WebIDL import (BuiltinTypes, IDLBuiltinType, IDLNullValue, IDLSequenceType, IDLType,
+                    IDLAttribute, IDLInterfaceMember, IDLUndefinedValue, IDLEmptySequenceValue,
+                    IDLDictionary)
+from Configuration import (NoSuchDescriptorError, getTypesFromDescriptor, getTypesFromDictionary,
+                           getTypesFromCallback, getAllTypes, Descriptor, MemberIsUnforgeable,
+                           iteratorNativeType)
 
 AUTOGENERATED_WARNING_COMMENT = \
     "/* THIS FILE IS AUTOGENERATED BY Codegen.py - DO NOT EDIT */\n\n"
 AUTOGENERATED_WITH_SOURCE_WARNING_COMMENT = \
     "/* THIS FILE IS AUTOGENERATED FROM %s BY Codegen.py - DO NOT EDIT */\n\n"
 ADDPROPERTY_HOOK_NAME = '_addProperty'
 FINALIZE_HOOK_NAME = '_finalize'
 OBJECT_MOVED_HOOK_NAME = '_objectMoved'
@@ -451,17 +455,18 @@ class CGDOMJSClass(CGThing):
     def __init__(self, descriptor):
         CGThing.__init__(self)
         self.descriptor = descriptor
 
     def declare(self):
         return ""
 
     def define(self):
-        callHook = LEGACYCALLER_HOOK_NAME if self.descriptor.operations["LegacyCaller"] else 'nullptr'
+        callHook = (LEGACYCALLER_HOOK_NAME
+                    if self.descriptor.operations["LegacyCaller"] else 'nullptr')
         objectMovedHook = OBJECT_MOVED_HOOK_NAME if self.descriptor.wrapperCache else 'nullptr'
         slotCount = InstanceReservedSlots(self.descriptor)
         classFlags = "JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | "
         if self.descriptor.isGlobal():
             classFlags += "JSCLASS_DOM_GLOBAL | JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(DOM_GLOBAL_SLOTS)"
             traceHook = "JS_GlobalObjectTraceHook"
             reservedSlots = "JSCLASS_GLOBAL_APPLICATION_SLOTS"
         else:
@@ -1599,17 +1604,18 @@ class CGAbstractMethod(CGThing):
         profiler_label_and_jscontext = self.profiler_label_and_jscontext()
         if profiler_label_and_jscontext:
             return 'AUTO_PROFILER_LABEL_FAST("%s", DOM, %s);' % profiler_label_and_jscontext
         return None
 
     def declare(self):
         if self.inline:
             return self._define(True)
-        return "%s%s%s(%s);\n" % (self._template(), self._decorators(), self.name, self._argstring(True))
+        return "%s%s%s(%s);\n" % (self._template(), self._decorators(),
+                                  self.name, self._argstring(True))
 
     def indent_body(self, body):
         """
         Indent the code returned by self.definition_body(). Most classes
         simply indent everything two spaces. This is here for
         CGRegisterProtos, which needs custom indentation.
         """
         return indent(body)
@@ -1769,18 +1775,18 @@ def objectMovedHook(descriptor, hookName
     assert descriptor.wrapperCache
     return fill("""
         if (self) {
           UpdateWrapper(self, self, ${obj}, ${old});
         }
 
         return 0;
         """,
-        obj=obj,
-        old=old)
+                obj=obj,
+                old=old)
 
 
 class CGClassObjectMovedHook(CGAbstractClassHook):
     """
     A hook for objectMovedOp, used to update the wrapper cache when an object it
     is holding moves.
     """
 
@@ -2210,33 +2216,33 @@ class PropertyDefiner:
             #pragma clang diagnostic pop
             #endif
 
             ${disablers}
             static const Prefable<${specType}> ${name}[] = {
             ${prefableSpecs}
             };
 
-            """,
+            """,  # NOQA: E501
             specType=specType,
             name=name,
             disablers='\n'.join(disablers),
             specs=',\n'.join(specs),
             prefableSpecs=',\n'.join(prefableSpecs))
 
         if self.usedForXrays():
             arrays = fill(
                 """
                 $*{arrays}
                 static_assert(${numPrefableSpecs} <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
                     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
                 static_assert(${maxNumSpecsInPrefable} <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
                     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
 
-                """,
+                """,  # NOQA: E501
                 arrays=arrays,
                 # Minus 1 because there's a list terminator in prefableSpecs.
                 numPrefableSpecs=len(prefableSpecs)-1,
                 maxNumSpecsInPrefable=maxNumSpecsInPrefable)
 
         return arrays
 
 
@@ -2304,19 +2310,20 @@ class MethodDefiner(PropertyDefiner):
                 # QueryInterface is special, because instead of generating an
                 # impl we just call out directly to our shared one.
                 if m.isStatic():
                     raise TypeError("Legacy QueryInterface member shouldn't be static")
                 signatures = m.signatures()
 
                 def argTypeIsIID(arg):
                     return arg.type.inner.isExternal() and arg.type.inner.identifier.name == 'IID'
-                if len(signatures) > 1 or len(signatures[0][1]) > 1 or not argTypeIsIID(signatures[0][1][0]):
+                if (len(signatures) > 1 or len(signatures[0][1]) > 1 or
+                    not argTypeIsIID(signatures[0][1][0])):
                     raise TypeError(
-                        "There should be only one QueryInterface method with 1 argument of type IID")
+                        "There should be only one QueryInterface method with 1 argument of type IID")  # NOQA: E501
 
                 # Make sure to not stick QueryInterface on abstract interfaces.
                 if (not self.descriptor.interface.hasInterfacePrototypeObject() or
                         not self.descriptor.concrete):
                     raise TypeError("QueryInterface is only supported on "
                                     "interfaces that are concrete: " +
                                     self.descriptor.name)
 
@@ -2572,19 +2579,19 @@ class AttrDefiner(PropertyDefiner):
             attributes = [m for m in descriptor.interface.members if
                           m.isAttr() and m.isStatic() == static and
                           MemberIsUnforgeable(m, descriptor) == unforgeable and
                           not isNonExposedNavigatorObjectGetter(m, descriptor)]
         else:
             attributes = []
 
         attributes = [
-            {"name": name, "attr": attr}
+            {"name": name_attr, "attr": attr}
             for attr in attributes
-            for name in [attr.identifier.name] + attr.bindingAliases
+            for name_attr in [attr.identifier.name] + attr.bindingAliases
         ]
 
         self.chrome = [m for m in attributes if isChromeOnly(m["attr"])]
         self.regular = [m for m in attributes if not isChromeOnly(m["attr"])]
         self.static = static
         self.unforgeable = unforgeable
 
         if static:
@@ -2844,26 +2851,26 @@ class CGNativeProperties(CGList):
                 if iteratorAliasIndex > 0:
                     # The iteratorAliasMethodIndex is a signed integer, so the
                     # max value it can store is 2^(nbits-1)-1.
                     post = fill(
                         """
                         $*{post}
                         static_assert(${iteratorAliasIndex} < 1ull << (CHAR_BIT * sizeof(${name}.iteratorAliasMethodIndex) - 1),
                             "We have an iterator alias index that is oversized");
-                        """,
+                        """,  # NOQA: E501
                         post=post,
                         iteratorAliasIndex=iteratorAliasIndex,
                         name=name)
                 post = fill(
                     """
                     $*{post}
                     static_assert(${propertyInfoCount} < 1ull << CHAR_BIT * sizeof(${name}.propertyInfoCount),
                         "We have a property info count that is oversized");
-                    """,
+                    """,  # NOQA: E501
                     post=post,
                     propertyInfoCount=idsOffset,
                     name=name)
                 nativePropsInts.append(CGGeneric("%d" % idsOffset))
                 nativePropsPtrs.append(CGGeneric("%s_sortedPropertyIndices" % name))
             else:
                 nativePropsInts.append(CGGeneric("0"))
                 nativePropsPtrs.append(CGGeneric("nullptr"))
@@ -2931,17 +2938,17 @@ class CGCollectJSONAttributesMethod(CGAb
                     ret += fill(
                         """
                         // This is unfortunately a linear scan through sAttributes, but we
                         // only do it for things which _might_ be disabled, which should
                         // help keep the performance problems down.
                         if (IsGetterEnabled(cx, unwrappedObj, (JSJitGetterOp)get_${name}, sAttributes)) {
                           $*{getAndDefine}
                         }
-                        """,
+                        """,  # NOQA: E501
                         name=IDLToCIdentifier(m.identifier.name),
                         getAndDefine=getAndDefine)
                 else:
                     ret += fill(
                         """
                         { // scope for "temp"
                           $*{getAndDefine}
                         }
@@ -3069,28 +3076,30 @@ class CGCreateInterfaceObjectsMethod(CGA
             constructArgs = 0
         if len(self.descriptor.interface.namedConstructors) > 0:
             namedConstructors = "namedConstructors"
         else:
             namedConstructors = "nullptr"
 
         if needInterfacePrototypeObject:
             protoClass = "&sPrototypeClass.mBase"
-            protoCache = "&aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::%s)" % self.descriptor.name
+            protoCache = ("&aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::%s)" %
+                          self.descriptor.name)
             parentProto = "parentProto"
             getParentProto = CGGeneric(getParentProto)
         else:
             protoClass = "nullptr"
             protoCache = "nullptr"
             parentProto = "nullptr"
             getParentProto = None
 
         if needInterfaceObject:
             interfaceClass = "&sInterfaceObjectClass.mBase"
-            interfaceCache = "&aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::%s)" % self.descriptor.name
+            interfaceCache = ("&aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::%s)" %
+                              self.descriptor.name)
             getConstructorProto = CGGeneric(getConstructorProto)
             constructorProto = "constructorProto"
         else:
             # We don't have slots to store the named constructors.
             assert len(self.descriptor.interface.namedConstructors) == 0
             interfaceClass = "nullptr"
             interfaceCache = "nullptr"
             getConstructorProto = None
@@ -3121,29 +3130,30 @@ class CGCreateInterfaceObjectsMethod(CGA
                                         ${toStringTag},
                                         ${constructorProto}, ${interfaceClass}, ${constructArgs}, ${namedConstructors},
                                         interfaceCache,
                                         ${properties},
                                         ${chromeProperties},
                                         ${name}, aDefineOnGlobal,
                                         ${unscopableNames},
                                         ${isGlobal});
-            """,
+            """,  # NOQA: E501
             protoClass=protoClass,
             parentProto=parentProto,
             protoCache=protoCache,
             toStringTag=toStringTag,
             constructorProto=constructorProto,
             interfaceClass=interfaceClass,
             constructArgs=constructArgs,
             namedConstructors=namedConstructors,
             interfaceCache=interfaceCache,
             properties=properties,
             chromeProperties=chromeProperties,
-            name='"' + self.descriptor.interface.identifier.name + '"' if needInterfaceObject else "nullptr",
+            name=('"' + self.descriptor.interface.identifier.name + '"'
+                  if needInterfaceObject else "nullptr"),
             unscopableNames="unscopableNames" if self.haveUnscopables else "nullptr",
             isGlobal=toStringBool(isGlobal))
 
         # If we fail after here, we must clear interface and prototype caches
         # using this code: intermediate failure must not expose the interface in
         # partially-constructed state.  Note that every case after here needs an
         # interface prototype object.
         failureCode = dedent(
@@ -3157,18 +3167,18 @@ class CGCreateInterfaceObjectsMethod(CGA
 
         aliasedMembers = [m for m in self.descriptor.interface.members if m.isMethod()
                           and m.aliases]
         if aliasedMembers:
             assert needInterfacePrototypeObject
 
             def defineAlias(alias):
                 if alias == "@@iterator":
-                    symbolJSID = "SYMBOL_TO_JSID(JS::GetWellKnownSymbol(aCx, JS::SymbolCode::iterator))"
-                    getSymbolJSID = CGGeneric(fill("JS::Rooted<jsid> iteratorId(aCx, ${symbolJSID});",
+                    symbolJSID = "SYMBOL_TO_JSID(JS::GetWellKnownSymbol(aCx, JS::SymbolCode::iterator))"  # NOQA: E501
+                    getSymbolJSID = CGGeneric(fill("JS::Rooted<jsid> iteratorId(aCx, ${symbolJSID});",  # NOQA: E501
                                                    symbolJSID=symbolJSID))
                     defineFn = "JS_DefinePropertyById"
                     prop = "iteratorId"
                     enumFlags = "0"  # Not enumerable, per spec.
                 elif alias.startswith("@@"):
                     raise TypeError("Can't handle any well-known Symbol other than @@iterator")
                 else:
                     getSymbolJSID = None
@@ -3241,17 +3251,17 @@ class CGCreateInterfaceObjectsMethod(CGA
                 JS::Rooted<JSObject*> unforgeableHolder(aCx);
                 {
                   JS::Rooted<JSObject*> holderProto(aCx, ${holderProto});
                   unforgeableHolder = JS_NewObjectWithoutMetadata(aCx, ${holderClass}, holderProto);
                   if (!unforgeableHolder) {
                     $*{failureCode}
                   }
                 }
-                """,
+                """,  # NOQA: E501
                 holderProto=holderProto,
                 holderClass=holderClass,
                 failureCode=failureCode))
             defineUnforgeables = InitUnforgeablePropertiesOnHolder(self.descriptor,
                                                                    self.properties,
                                                                    failureCode)
             createUnforgeableHolder = CGList(
                 [createUnforgeableHolder, defineUnforgeables])
@@ -3421,17 +3431,17 @@ class CGGetNamedPropertiesObjectMethod(C
               MOZ_ASSERT(clasp->mNativeHooks,
                          "The named properties object for ${nativeType} should have NativePropertyHooks.");
               MOZ_ASSERT(!clasp->mNativeHooks->mResolveOwnProperty,
                          "Shouldn't resolve the properties of the named properties object for ${nativeType} for Xrays.");
               MOZ_ASSERT(!clasp->mNativeHooks->mEnumerateOwnProperties,
                          "Shouldn't enumerate the properties of the named properties object for ${nativeType} for Xrays.");
             }
             return namedPropertiesObject.get();
-            """,
+            """,  # NOQA: E501
             getParentProto=getParentProto,
             ifaceName=self.descriptor.name,
             parentProto=parentProto,
             nativeType=self.descriptor.nativeType)
 
 
 def getConditionList(idlobj, cxName, objName):
     """
@@ -3837,17 +3847,17 @@ class CGWrapWithCacheMethod(CGAbstractMe
             // aGivenProto here, since it's entirely possible (and even
             // somewhat common) to have a non-null aGivenProto which is the
             // same as canonicalProto.
             if (proto != canonicalProto) {
               PreserveWrapper(aObject);
             }
 
             return true;
-            """,
+            """,  # NOQA: E501
             nativeType=self.descriptor.nativeType,
             assertInheritance=AssertInheritanceChain(self.descriptor),
             declareProto=DeclareProto(),
             createObject=CreateBindingJSObject(self.descriptor, self.properties),
             unforgeable=CopyUnforgeablePropertiesToInstance(self.descriptor,
                                                             failureCode),
             slots=InitMemberSlots(self.descriptor, failureCode),
             setImmutablePrototype=SetImmutablePrototype(self.descriptor,
@@ -3863,17 +3873,17 @@ class CGWrapMethod(CGAbstractMethod):
                 Argument('JS::Handle<JSObject*>', 'aGivenProto')]
         CGAbstractMethod.__init__(self, descriptor, 'Wrap', 'JSObject*', args,
                                   inline=True, templateArgs=["class T"])
 
     def definition_body(self):
         return dedent("""
             JS::Rooted<JSObject*> reflector(aCx);
             return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
-            """)
+            """)  # NOQA: E501
 
 
 class CGWrapNonWrapperCacheMethod(CGAbstractMethod):
     """
     Create a wrapper JSObject for a given native that does not implement
     nsWrapperCache.
 
     properties should be a PropertyArrays instance.
@@ -3942,17 +3952,17 @@ class CGWrapGlobalMethod(CGAbstractMetho
         self.properties = properties
 
     def definition_body(self):
         if self.properties.hasNonChromeOnly():
             properties = "sNativeProperties.Upcast()"
         else:
             properties = "nullptr"
         if self.properties.hasChromeOnly():
-            chromeProperties = "nsContentUtils::ThreadsafeIsSystemCaller(aCx) ? sChromeOnlyNativeProperties.Upcast() : nullptr"
+            chromeProperties = "nsContentUtils::ThreadsafeIsSystemCaller(aCx) ? sChromeOnlyNativeProperties.Upcast() : nullptr"  # NOQA: E501
         else:
             chromeProperties = "nullptr"
 
         failureCode = dedent(
             """
             aCache->ReleaseWrapper(aObject);
             aCache->ClearWrapper();
             return false;
@@ -4027,17 +4037,17 @@ class CGUpdateMemberSlotsMethod(CGAbstra
                     """
 
                     static_assert(${slot} < js::shadow::Object::MAX_FIXED_SLOTS,
                                   "Not enough fixed slots to fit '${interface}.${member}.  Ion's visitGetDOMMemberV/visitGetDOMMemberT assume StoreInSlot things are all in fixed slots.");
                     if (!get_${member}(aCx, aWrapper, aObject, args)) {
                       return false;
                     }
                     // Getter handled setting our reserved slots
-                    """,
+                    """,  # NOQA: E501
                     slot=memberReservedSlot(m, self.descriptor),
                     interface=self.descriptor.interface.identifier.name,
                     member=m.identifier.name)
 
         body += "\nreturn true;\n"
         return body
 
 
@@ -4175,17 +4185,17 @@ class CGCycleCollectionTraverseForOwning
 
     def definition_body(self):
         memberNames = [getUnionMemberName(t)
                        for t in self.type.flatMemberTypes
                        if idlTypeNeedsCycleCollection(t)]
         assert memberNames
 
         conditionTemplate = 'aUnion.Is%s()'
-        functionCallTemplate = 'ImplCycleCollectionTraverse(aCallback, aUnion.GetAs%s(), "m%s", aFlags);\n'
+        functionCallTemplate = 'ImplCycleCollectionTraverse(aCallback, aUnion.GetAs%s(), "m%s", aFlags);\n'  # NOQA: E501
 
         ifStaments = (CGIfWrapper(CGGeneric(functionCallTemplate % (m, m)),
                                   conditionTemplate % m)
                       for m in memberNames)
 
         return CGElseChain(ifStaments).define()
 
 
@@ -4294,17 +4304,17 @@ class CastableObjectUnwrapper():
                       !GetContentGlobalForJSImplementedObject(cx, callback, getter_AddRefs(contentGlobal))) {
                     $*{exceptionCode}
                   }
                   JS::Rooted<JSObject*> jsImplSourceObj(cx, &${source}.toObject());
                   ${target} = new ${type}(jsImplSourceObj, contentGlobal);
                 } else {
                   $*{codeOnFailure}
                 }
-                """,
+                """,  # NOQA: E501
                 exceptionCode=exceptionCode,
                 **self.substitution)
         else:
             self.substitution["codeOnFailure"] = codeOnFailure
 
     def __str__(self):
         substitution = self.substitution.copy()
         substitution["codeOnFailure"] %= {
@@ -4697,17 +4707,18 @@ def getJSToNativeConversionInfo(type, de
         templateBody = "${declName} = &${val}.toObject();\n"
 
         # For JS-implemented APIs, we refuse to allow passing objects that the
         # API consumer does not subsume. The extra parens around
         # ($${passedToJSImpl}) suppress unreachable code warnings when
         # $${passedToJSImpl} is the literal `false`.  But Apple is shipping a
         # buggy clang (clang 3.9) in Xcode 8.3, so there even the parens are not
         # enough.  So we manually disable some warnings in clang.
-        if not isinstance(descriptorProvider, Descriptor) or descriptorProvider.interface.isJSImplemented():
+        if (not isinstance(descriptorProvider, Descriptor) or
+            descriptorProvider.interface.isJSImplemented()):
             templateBody = fill(
                 """
                 #ifdef __clang__
                 #pragma clang diagnostic push
                 #pragma clang diagnostic ignored "-Wunreachable-code"
                 #pragma clang diagnostic ignored "-Wunreachable-code-return"
                 #endif // __clang__
                 if (($${passedToJSImpl}) && !CallerSubsumes($${val})) {
@@ -4826,17 +4837,17 @@ def getJSToNativeConversionInfo(type, de
               ${elementType}* slotPtr${nestingLevel} = arr${nestingLevel}.AppendElement(mozilla::fallible);
               if (!slotPtr${nestingLevel}) {
                 JS_ReportOutOfMemory(cx);
                 $*{exceptionCode}
               }
               ${elementType}& slot${nestingLevel} = *slotPtr${nestingLevel};
               $*{elementConversion}
             }
-            """,
+            """,  # NOQA: E501
             exceptionCode=exceptionCode,
             notSequence=notSequence,
             sequenceType=sequenceType,
             arrayRef=arrayRef,
             elementType=elementInfo.declType.define(),
             elementConversion=elementConversion,
             nestingLevel=str(nestingLevel))
 
@@ -5051,30 +5062,30 @@ def getJSToNativeConversionInfo(type, de
         names = []
 
         interfaceMemberTypes = filter(lambda t: t.isNonCallbackInterface(), memberTypes)
         if len(interfaceMemberTypes) > 0:
             interfaceObject = []
             for memberType in interfaceMemberTypes:
                 name = getUnionMemberName(memberType)
                 interfaceObject.append(
-                    CGGeneric("(failed = !%s.TrySetTo%s(cx, ${val}, tryNext, ${passedToJSImpl})) || !tryNext" %
+                    CGGeneric("(failed = !%s.TrySetTo%s(cx, ${val}, tryNext, ${passedToJSImpl})) || !tryNext" %  # NOQA: E501
                               (unionArgumentObj, name)))
                 names.append(name)
             interfaceObject = CGWrapper(CGList(interfaceObject, " ||\n"),
                                         pre="done = ", post=";\n\n", reindent=True)
         else:
             interfaceObject = None
 
         sequenceObjectMemberTypes = filter(lambda t: t.isSequence(), memberTypes)
         if len(sequenceObjectMemberTypes) > 0:
             assert len(sequenceObjectMemberTypes) == 1
             name = getUnionMemberName(sequenceObjectMemberTypes[0])
             sequenceObject = CGGeneric(
-                "done = (failed = !%s.TrySetTo%s(cx, ${val}, tryNext, ${passedToJSImpl})) || !tryNext;\n" %
+                "done = (failed = !%s.TrySetTo%s(cx, ${val}, tryNext, ${passedToJSImpl})) || !tryNext;\n" %  # NOQA: E501
                 (unionArgumentObj, name))
             names.append(name)
         else:
             sequenceObject = None
 
         dateObjectMemberTypes = filter(lambda t: t.isDate(), memberTypes)
         if len(dateObjectMemberTypes) > 0:
             assert len(dateObjectMemberTypes) == 1
@@ -5089,59 +5100,60 @@ def getJSToNativeConversionInfo(type, de
 
         callbackMemberTypes = filter(lambda t: t.isCallback()
                                      or t.isCallbackInterface(), memberTypes)
         if len(callbackMemberTypes) > 0:
             assert len(callbackMemberTypes) == 1
             memberType = callbackMemberTypes[0]
             name = getUnionMemberName(memberType)
             callbackObject = CGGeneric(
-                "done = (failed = !%s.TrySetTo%s(cx, ${val}, tryNext, ${passedToJSImpl})) || !tryNext;\n" %
+                "done = (failed = !%s.TrySetTo%s(cx, ${val}, tryNext, ${passedToJSImpl})) || !tryNext;\n" %  # NOQA: E501
                 (unionArgumentObj, name))
             names.append(name)
         else:
             callbackObject = None
 
         dictionaryMemberTypes = filter(lambda t: t.isDictionary(), memberTypes)
         if len(dictionaryMemberTypes) > 0:
             assert len(dictionaryMemberTypes) == 1
             name = getUnionMemberName(dictionaryMemberTypes[0])
             setDictionary = CGGeneric(
-                "done = (failed = !%s.TrySetTo%s(cx, ${val}, tryNext, ${passedToJSImpl})) || !tryNext;\n" %
+                "done = (failed = !%s.TrySetTo%s(cx, ${val}, tryNext, ${passedToJSImpl})) || !tryNext;\n" %  # NOQA: E501
                 (unionArgumentObj, name))
             names.append(name)
         else:
             setDictionary = None
 
         recordMemberTypes = filter(lambda t: t.isRecord(), memberTypes)
         if len(recordMemberTypes) > 0:
             assert len(recordMemberTypes) == 1
             name = getUnionMemberName(recordMemberTypes[0])
             recordObject = CGGeneric(
-                "done = (failed = !%s.TrySetTo%s(cx, ${val}, tryNext, ${passedToJSImpl})) || !tryNext;\n" %
+                "done = (failed = !%s.TrySetTo%s(cx, ${val}, tryNext, ${passedToJSImpl})) || !tryNext;\n" %  # NOQA: E501
                 (unionArgumentObj, name))
             names.append(name)
         else:
             recordObject = None
 
         objectMemberTypes = filter(lambda t: t.isObject(), memberTypes)
         if len(objectMemberTypes) > 0:
             assert len(objectMemberTypes) == 1
             # Very important to NOT construct a temporary Rooted here, since the
             # SetToObject call can call a Rooted constructor and we need to keep
             # stack discipline for Rooted.
-            object = CGGeneric("if (!%s.SetToObject(cx, &${val}.toObject(), ${passedToJSImpl})) {\n"
+            object = CGGeneric("if (!%s.SetToObject(cx, &${val}.toObject(), ${passedToJSImpl})) {\n"  # NOQA: E501
                                "%s"
                                "}\n"
-                               "done = true;\n" % (unionArgumentObj, indent(exceptionCode)))
+                               "done = true;\n" % (unionArgumentObj, indent(exceptionCode)))  # NOQA: E501
             names.append(objectMemberTypes[0].name)
         else:
             object = None
 
-        hasObjectTypes = interfaceObject or sequenceObject or dateObject or callbackObject or object or recordObject
+        hasObjectTypes = (interfaceObject or sequenceObject or dateObject
+                          or callbackObject or object or recordObject)
         if hasObjectTypes:
             # "object" is not distinguishable from other types
             assert not object or not (
                 interfaceObject or sequenceObject or dateObject or callbackObject or recordObject)
             if sequenceObject or dateObject or callbackObject:
                 # An object can be both an sequence object and a callback or
                 # dictionary, but we shouldn't have both in the union's members
                 # because they are not distinguishable.
@@ -5181,17 +5193,17 @@ def getJSToNativeConversionInfo(type, de
             assert len(stringTypes) <= 1
             assert len(numericTypes) <= 1
             assert len(booleanTypes) <= 1
 
             # We will wrap all this stuff in a do { } while (0); so we
             # can use "break" for flow control.
             def getStringOrPrimitiveConversion(memberType):
                 name = getUnionMemberName(memberType)
-                return CGGeneric("done = (failed = !%s.TrySetTo%s(cx, ${val}, tryNext)) || !tryNext;\n"
+                return CGGeneric("done = (failed = !%s.TrySetTo%s(cx, ${val}, tryNext)) || !tryNext;\n"  # NOQA: E501
                                  "break;\n" % (unionArgumentObj, name))
             other = CGList([])
             stringConversion = map(getStringOrPrimitiveConversion, stringTypes)
             numericConversion = map(getStringOrPrimitiveConversion, numericTypes)
             booleanConversion = map(getStringOrPrimitiveConversion, booleanTypes)
             if stringConversion:
                 if booleanConversion:
                     other.append(CGIfWrapper(booleanConversion[0],
@@ -5218,17 +5230,18 @@ def getJSToNativeConversionInfo(type, de
                     other = CGWrapper(other, pre="if (!done) ")
                     templateBody = CGList([templateBody, other])
             else:
                 assert templateBody.define() == ""
                 templateBody = other
         else:
             other = None
 
-        templateBody = CGWrapper(templateBody, pre="bool done = false, failed = false, tryNext;\n")
+        templateBody = CGWrapper(templateBody,
+                                 pre="bool done = false, failed = false, tryNext;\n")
         throw = CGGeneric(fill(
             """
             if (failed) {
               $*{exceptionCode}
             }
             if (!done) {
               ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "${desc}", "${names}");
               $*{exceptionCode}
@@ -5367,17 +5380,18 @@ def getJSToNativeConversionInfo(type, de
 
         templateBody = CGList([constructDecl, templateBody])
 
         return JSToNativeConversionInfo(templateBody.define(),
                                         declType=declType,
                                         declArgs=declArgs,
                                         holderType=holderType,
                                         holderArgs=holderArgs,
-                                        dealWithOptional=isOptional and (not nullable or isOwningUnion))
+                                        dealWithOptional=isOptional and
+                                        (not nullable or isOwningUnion))
 
     if type.isPromise():
         assert not type.nullable()
         assert defaultValue is None
 
         # We always have to hold a strong ref to Promise here, because
         # Promise::resolve returns an addrefed thing.
         argIsPointer = isCallbackReturnValue
@@ -5570,17 +5584,17 @@ def getJSToNativeConversionInfo(type, de
         else:
             if forceOwningType:
                 declType = "OwningNonNull<" + typeName + ">"
             else:
                 declType = "NonNull<" + typeName + ">"
 
         templateBody = ""
         if forceOwningType:
-            templateBody += 'static_assert(IsRefcounted<%s>::value, "We can only store refcounted classes.");' % typeName
+            templateBody += 'static_assert(IsRefcounted<%s>::value, "We can only store refcounted classes.");' % typeName  # NOQA: E501
 
         if (not descriptor.interface.isConsequential() and
                 not descriptor.interface.isExternal()):
             if failureCode is not None:
                 templateBody += str(CastableObjectUnwrapper(
                     descriptor,
                     "${val}",
                     "${maybeMutableVal}",
@@ -5604,19 +5618,19 @@ def getJSToNativeConversionInfo(type, de
             if forceOwningType:
                 # Don't return a holderType in this case; our declName
                 # will just own stuff.
                 templateBody += "RefPtr<" + typeName + "> ${holderName};\n"
             else:
                 holderType = "RefPtr<" + typeName + ">"
             templateBody += (
                 "JS::Rooted<JSObject*> source(cx, &${val}.toObject());\n" +
-                "if (NS_FAILED(UnwrapArg<" + typeName + ">(cx, source, getter_AddRefs(${holderName})))) {\n")
+                "if (NS_FAILED(UnwrapArg<" + typeName + ">(cx, source, getter_AddRefs(${holderName})))) {\n")  # NOQA: E501
             templateBody += CGIndenter(onFailureBadType(failureCode,
-                                                        descriptor.interface.identifier.name)).define()
+                                                        descriptor.interface.identifier.name)).define()  # NOQA: E501
             templateBody += ("}\n"
                              "MOZ_ASSERT(${holderName});\n")
 
             # And store our value in ${declName}
             templateBody += "${declName} = ${holderName};\n"
 
         # Just pass failureCode, not onFailureBadType, here, so we'll report
         # the thing as not an object as opposed to not implementing whatever
@@ -5712,17 +5726,17 @@ def getJSToNativeConversionInfo(type, de
             if type.isUSVString():
                 normalizeCode = "NormalizeUSVString(%s);\n" % varName
 
             conversionCode = fill("""
                 if (!ConvertJSValueToString(cx, $${val}, ${nullBehavior}, ${undefinedBehavior}, ${varName})) {
                   $*{exceptionCode}
                 }
                 $*{normalizeCode}
-                """,
+                """,  # NOQA: E501
                                   nullBehavior=nullBehavior,
                                   undefinedBehavior=undefinedBehavior,
                                   varName=varName,
                                   exceptionCode=exceptionCode,
                                   normalizeCode=normalizeCode)
 
             if defaultValue is None:
                 return conversionCode
@@ -5819,17 +5833,17 @@ def getJSToNativeConversionInfo(type, de
             {
               int index;
               if (!FindEnumStringIndex<${invalidEnumValueFatal}>(cx, $${val}, ${values}, "${enumtype}", "${sourceDescription}", &index)) {
                 $*{exceptionCode}
               }
               $*{handleInvalidEnumValueCode}
               ${enumLoc} = static_cast<${enumtype}>(index);
             }
-            """,
+            """,  # NOQA: E501
             enumtype=enumName,
             values=enumName + "Values::" + ENUM_ENTRY_VARIABLE_NAME,
             invalidEnumValueFatal=toStringBool(invalidEnumValueFatal),
             handleInvalidEnumValueCode=handleInvalidEnumValueCode,
             exceptionCode=exceptionCode,
             enumLoc=enumLoc,
             sourceDescription=firstCap(sourceDescription))
 
@@ -5920,17 +5934,18 @@ def getJSToNativeConversionInfo(type, de
         templateBody = "${declName} = ${val};\n"
 
         # For JS-implemented APIs, we refuse to allow passing objects that the
         # API consumer does not subsume. The extra parens around
         # ($${passedToJSImpl}) suppress unreachable code warnings when
         # $${passedToJSImpl} is the literal `false`.  But Apple is shipping a
         # buggy clang (clang 3.9) in Xcode 8.3, so there even the parens are not
         # enough.  So we manually disable some warnings in clang.
-        if not isinstance(descriptorProvider, Descriptor) or descriptorProvider.interface.isJSImplemented():
+        if (not isinstance(descriptorProvider, Descriptor) or
+            descriptorProvider.interface.isJSImplemented()):
             templateBody = fill(
                 """
                 #ifdef __clang__
                 #pragma clang diagnostic push
                 #pragma clang diagnostic ignored "-Wunreachable-code"
                 #pragma clang diagnostic ignored "-Wunreachable-code-return"
                 #endif // __clang__
                 if (($${passedToJSImpl}) && !CallerSubsumes($${val})) {
@@ -6119,32 +6134,32 @@ def getJSToNativeConversionInfo(type, de
         if defaultValue is not None and isinstance(defaultValue, IDLNullValue):
             nullCondition = "!(${haveValue}) || " + nullCondition
         template = fill("""
             if (${nullCondition}) {
               $${declName}.SetNull();
             } else if (!ValueToPrimitive<${typeName}, ${conversionBehavior}>(cx, $${val}, &${writeLoc})) {
               $*{exceptionCode}
             }
-            """,
+            """,  # NOQA: E501
                         nullCondition=nullCondition,
                         typeName=typeName,
                         conversionBehavior=conversionBehavior,
                         writeLoc=writeLoc,
                         exceptionCode=exceptionCode)
     else:
         assert(defaultValue is None or
                not isinstance(defaultValue, IDLNullValue))
         writeLoc = "${declName}"
         readLoc = writeLoc
         template = fill("""
             if (!ValueToPrimitive<${typeName}, ${conversionBehavior}>(cx, $${val}, &${writeLoc})) {
               $*{exceptionCode}
             }
-            """,
+            """,  # NOQA: E501
                         typeName=typeName,
                         conversionBehavior=conversionBehavior,
                         writeLoc=writeLoc,
                         exceptionCode=exceptionCode)
         declType = CGGeneric(typeName)
 
     if type.isFloat() and not type.isUnrestricted():
         if lenientFloatCode is not None:
@@ -6743,23 +6758,25 @@ def getWrapTemplateForType(type, descrip
 
         wrappingCode += wrapAndSetPtr(wrap, failed)
         return (wrappingCode, False)
 
     if type.isDOMString() or type.isUSVString():
         if type.nullable():
             return (wrapAndSetPtr("xpc::StringToJsval(cx, %s, ${jsvalHandle})" % result), False)
         else:
-            return (wrapAndSetPtr("xpc::NonVoidStringToJsval(cx, %s, ${jsvalHandle})" % result), False)
+            return (wrapAndSetPtr("xpc::NonVoidStringToJsval(cx, %s, ${jsvalHandle})" % result),
+                    False)
 
     if type.isByteString():
         if type.nullable():
             return (wrapAndSetPtr("ByteStringToJsval(cx, %s, ${jsvalHandle})" % result), False)
         else:
-            return (wrapAndSetPtr("NonVoidByteStringToJsval(cx, %s, ${jsvalHandle})" % result), False)
+            return (wrapAndSetPtr("NonVoidByteStringToJsval(cx, %s, ${jsvalHandle})" % result),
+                    False)
 
     if type.isEnum():
         if type.nullable():
             resultLoc = "%s.Value()" % result
         else:
             resultLoc = result
         conversion = fill(
             """
@@ -7564,17 +7581,18 @@ class CGPerSignatureCall(CGThing):
                                                                    getter=getter,
                                                                    setter=setter)
         self.arguments = arguments
         self.argCount = len(arguments)
         self.isConstructor = isConstructor
         cgThings = []
 
         deprecated = (idlNode.getExtendedAttribute("Deprecated") or
-                      (idlNode.isStatic() and descriptor.interface.getExtendedAttribute("Deprecated")))
+                      (idlNode.isStatic() and
+                       descriptor.interface.getExtendedAttribute("Deprecated")))
         if deprecated:
             cgThings.append(CGGeneric(dedent(
                 """
                 DeprecationWarning(cx, obj, nsIDocument::e%s);
                 """ % deprecated[0])))
 
         lenientFloatCode = None
         if (idlNode.getExtendedAttribute('LenientFloat') is not None and
@@ -7629,17 +7647,17 @@ class CGPerSignatureCall(CGThing):
                 # We need the desired proto in our constructor, because the
                 # constructor will actually construct our reflector.
                 argsPost.append("desiredProto")
         elif descriptor.interface.isJSImplemented():
             if not idlNode.isStatic():
                 needsUnwrap = True
                 needsUnwrappedVar = True
                 argsPost.append(
-                    "(unwrappedObj ? js::GetNonCCWObjectRealm(*unwrappedObj) : js::GetContextRealm(cx))")
+                    "(unwrappedObj ? js::GetNonCCWObjectRealm(*unwrappedObj) : js::GetContextRealm(cx))")  # NOQA: E501
         elif needScopeObject(returnType, arguments, self.extendedAttributes,
                              descriptor.wrapperCache, True,
                              idlNode.getExtendedAttribute("StoreInSlot")):
             needsUnwrap = True
             needsUnwrappedVar = True
             argsPre.append("unwrappedObj ? *unwrappedObj : obj")
 
         if needsUnwrap and needsUnwrappedVar:
@@ -7759,17 +7777,17 @@ class CGPerSignatureCall(CGThing):
 
         # If this is a method that was generated by a maplike/setlike
         # interface, use the maplike/setlike generator to fill in the body.
         # Otherwise, use CGCallGenerator to call the native method.
         if idlNode.isMethod() and idlNode.isMaplikeOrSetlikeOrIterableMethod():
             if (idlNode.maplikeOrSetlikeOrIterable.isMaplike() or
                     idlNode.maplikeOrSetlikeOrIterable.isSetlike()):
                 cgThings.append(CGMaplikeOrSetlikeMethodGenerator(descriptor,
-                                                                  idlNode.maplikeOrSetlikeOrIterable,
+                                                                  idlNode.maplikeOrSetlikeOrIterable,  # NOQA: E501
                                                                   idlNode.identifier.name))
             else:
                 cgThings.append(CGIterableMethodGenerator(descriptor,
                                                           idlNode.maplikeOrSetlikeOrIterable,
                                                           idlNode.identifier.name))
         else:
             cgThings.append(CGCallGenerator(
                 self.isFallible(),
@@ -7799,17 +7817,17 @@ class CGPerSignatureCall(CGThing):
         returnsNewObject = memberReturnsNewObject(self.idlNode)
         if (returnsNewObject and
             (self.returnType.isGeckoInterface() or
              self.returnType.isPromise())):
             wrapCode += dedent(
                 """
                 static_assert(!IsPointer<decltype(result)>::value,
                               "NewObject implies that we need to keep the object alive with a strong reference.");
-                """)
+                """)  # NOQA: E501
 
         setSlot = self.idlNode.isAttr() and self.idlNode.slotIndices is not None
         if setSlot:
             # For attributes in slots, we want to do some
             # post-processing once we've wrapped them.
             successCode = "break;\n"
         else:
             successCode = None
@@ -7870,17 +7888,17 @@ class CGPerSignatureCall(CGThing):
                       JS::Rooted<JSObject*> rvalObj(cx, &args.rval().toObject());
                       JS::Rooted<JS::Value> includesVal(cx);
                       if (!JS_GetProperty(cx, rvalObj, "includes", &includesVal) ||
                           !JS_DefineProperty(cx, rvalObj, "contains", includesVal, JSPROP_ENUMERATE)) {
                         return false;
                       }
                     }
 
-                    """)
+                    """)  # NOQA: E501
             if self.idlNode.getExtendedAttribute("Frozen"):
                 assert self.idlNode.type.isSequence() or self.idlNode.type.isDictionary()
                 freezeValue = CGGeneric(
                     "JS::Rooted<JSObject*> rvalObj(cx, &args.rval().toObject());\n"
                     "if (!JS_FreezeObject(cx, rvalObj)) {\n"
                     "  return false;\n"
                     "}\n")
                 if self.idlNode.type.nullable():
@@ -8180,17 +8198,18 @@ class CGMethodCall(CGThing):
                 # case undefined was passed in.
                 argIsOptional = distinguishingArgument(signature).canHaveMissingValue()
                 testCode = instantiateJSToNativeConversion(
                     getJSToNativeConversionInfo(type, descriptor,
                                                 failureCode=failureCode,
                                                 isDefinitelyObject=isDefinitelyObject,
                                                 isNullOrUndefined=isNullOrUndefined,
                                                 isOptional=argIsOptional,
-                                                sourceDescription=(argDesc % (distinguishingIndex + 1))),
+                                                sourceDescription=(
+                                                    argDesc % (distinguishingIndex + 1))),
                     {
                         "declName": "arg%d" % distinguishingIndex,
                         "holderName": ("arg%d" % distinguishingIndex) + "_holder",
                         "val": distinguishingArg,
                         "obj": "obj",
                         "haveValue": "args.hasDefined(%d)" % distinguishingIndex,
                         "passedToJSImpl": toStringBool(isJSImplementedDescriptor(descriptor))
                     },
@@ -8396,17 +8415,17 @@ class CGMethodCall(CGThing):
             if stringSignature:
                 addCase(stringSignature, None)
 
             if (not booleanSignature and not numericSignature and
                     not stringSignature):
                 # Just throw; we have no idea what we're supposed to
                 # do with this.
                 caseBody.append(CGGeneric(
-                    'return ThrowErrorMessage(cx, MSG_OVERLOAD_RESOLUTION_FAILED, "%d", "%d", "%s");\n' %
+                    'return ThrowErrorMessage(cx, MSG_OVERLOAD_RESOLUTION_FAILED, "%d", "%d", "%s");\n' %  # NOQA: E501
                     (distinguishingIndex + 1, argCount, methodName)))
 
             argCountCases.append(CGCase(str(argCount), CGList(caseBody)))
 
         overloadCGThings = []
         overloadCGThings.append(
             CGGeneric("unsigned argcount = std::min(args.length(), %du);\n" %
                       maxArgCount))
@@ -8514,17 +8533,18 @@ class CGSetterCall(CGPerSignatureCall):
         if attr.getExtendedAttribute("UseCounter"):
             useCounterName = "%s_%s_setter" % (descriptor.interface.identifier.name,
                                                attr.identifier.name)
         else:
             useCounterName = None
         if attr.isStatic():
             nativeMethodName = "%s::%s" % (descriptor.nativeType, nativeMethodName)
         CGPerSignatureCall.__init__(self, None,
-                                    [FakeArgument(argType, attr, allowTreatNonCallableAsNull=True)],
+                                    [FakeArgument(argType, attr,
+                                                  allowTreatNonCallableAsNull=True)],
                                     nativeMethodName, attr.isStatic(),
                                     descriptor, attr, setter=True, useCounterName=useCounterName)
 
     def wrap_return_value(self):
         attr = self.idlNode
         if self.descriptor.wrapperCache and attr.slotIndices is not None:
             if attr.getExtendedAttribute("StoreInSlot"):
                 args = "cx, self"
@@ -8557,17 +8577,17 @@ class CGAbstractBindingMethod(CGAbstract
     called 'args'.  This can be "" if there is already such a variable
     around.
     """
     def __init__(self, descriptor, name, args, unwrapFailureCode=None,
                  getThisObj=None,
                  callArgs="JS::CallArgs args = JS::CallArgsFromVp(argc, vp);\n"):
         CGAbstractStaticMethod.__init__(self, descriptor, name, "bool", args)
 
-        self.unwrapFailureCode = 'return ThrowErrorMessage(cx, MSG_THIS_DOES_NOT_IMPLEMENT_INTERFACE, "Value", "%s");\n' % descriptor.interface.identifier.name
+        self.unwrapFailureCode = 'return ThrowErrorMessage(cx, MSG_THIS_DOES_NOT_IMPLEMENT_INTERFACE, "Value", "%s");\n' % descriptor.interface.identifier.name  # NOQA: E501
 
         if getThisObj == "":
             self.getThisObj = None
         else:
             self.getThisObj = CGGeneric("JS::Rooted<JSObject*> obj(cx, %s);\n" %
                                         getThisObj)
         self.callArgs = callArgs
 
@@ -8987,28 +9007,28 @@ class CGSpecializedGetter(CGAbstractStat
                     """
                     // Have to either root across the getter call or reget after.
                     bool isXray;
                     JS::Rooted<JSObject*> slotStorage(cx, GetCachedSlotStorageObject(cx, obj, &isXray));
                     if (!slotStorage) {
                       return false;
                     }
                     const size_t slotIndex = isXray ? ${xraySlotIndex} : ${slotIndex};
-                    """,
+                    """,  # NOQA: E501
                     xraySlotIndex=memberXrayExpandoReservedSlot(self.attr,
                                                                 self.descriptor),
                     slotIndex=memberReservedSlot(self.attr, self.descriptor))
             else:
                 prefix = fill(
                     """
                     // Have to either root across the getter call or reget after.
                     JS::Rooted<JSObject*> slotStorage(cx, js::UncheckedUnwrap(obj, /* stopAtWindowProxy = */ false));
                     MOZ_ASSERT(IsDOMObject(slotStorage));
                     const size_t slotIndex = ${slotIndex};
-                    """,
+                    """,  # NOQA: E501
                     slotIndex=memberReservedSlot(self.attr, self.descriptor))
 
             prefix += fill(
                 """
                 MOZ_ASSERT(JSCLASS_RESERVED_SLOTS(js::GetObjectClass(slotStorage)) > slotIndex);
                 {
                   // Scope for cachedVal
                   JS::Value cachedVal = js::GetReservedSlot(slotStorage, slotIndex);
@@ -9306,17 +9326,17 @@ class CGMemberJITInfo(CGThing):
             return initializer.rstrip()
 
         slotAssert = fill(
             """
             static_assert(${slotIndex} <= JSJitInfo::maxSlotIndex, "We won't fit");
             static_assert(${slotIndex} < ${classReservedSlots}, "There is no slot for us");
             """,
             slotIndex=slotIndex,
-            classReservedSlots=INSTANCE_RESERVED_SLOTS + self.descriptor.interface.totalMembersInSlots)
+            classReservedSlots=INSTANCE_RESERVED_SLOTS + self.descriptor.interface.totalMembersInSlots)  # NOQA: E501
         if args is not None:
             argTypes = "%s_argTypes" % infoName
             args = [CGMemberJITInfo.getJSArgType(arg.type) for arg in args]
             args.append("JSJitInfo::ArgTypeListEnd")
             argTypesDecl = (
                 "static const JSJitInfo::ArgType %s[] = { %s };\n" %
                 (argTypes, ", ".join(args)))
             return fill(
@@ -9606,17 +9626,18 @@ class CGMemberJITInfo(CGThing):
         # Different types
         return "JSVAL_TYPE_UNKNOWN"
 
     @staticmethod
     def getJSArgType(t):
         assert not t.isVoid()
         if t.nullable():
             # Sometimes it might return null, sometimes not
-            return "JSJitInfo::ArgType(JSJitInfo::Null | %s)" % CGMemberJITInfo.getJSArgType(t.inner)
+            return ("JSJitInfo::ArgType(JSJitInfo::Null | %s)" %
+                    CGMemberJITInfo.getJSArgType(t.inner))
         if t.isSequence():
             return "JSJitInfo::Object"
         if t.isPromise():
             return "JSJitInfo::Object"
         if t.isGeckoInterface():
             return "JSJitInfo::Object"
         if t.isString():
             return "JSJitInfo::String"
@@ -9789,19 +9810,16 @@ class CGEnum(CGThing):
             enum class ${name} : ${ty} {
               $*{enums}
               EndGuard_
             };
             """,
             name=self.enum.identifier.name,
             ty=self.underlyingType(),
             enums=",\n".join(map(getEnumValueName, self.enum.values())) + ",\n")
-        strings = CGNamespace(self.stringsNamespace(),
-                              CGGeneric(declare="extern const EnumEntry %s[%d];\n"
-                                        % (ENUM_ENTRY_VARIABLE_NAME, self.nEnumStrings())))
         return decl + "\n" + self.cgThings.declare()
 
     def define(self):
         return self.cgThings.define()
 
     def deps(self):
         return self.enum.getDeps()
 
@@ -10077,17 +10095,17 @@ class CGUnionStruct(CGThing):
                 methods.append(ClassMethod(
                     "RawSetAs" + vars["name"],
                     vars["structType"] + "&",
                     vars["ctorArgList"],
                     bodyInHeader=not self.ownsMembers,
                     body=body % "MOZ_ASSERT(mType == eUninitialized);"))
                 uninit = "Uninit();"
                 if hasObjectType and not self.ownsMembers:
-                    uninit = 'MOZ_ASSERT(mType != eObject, "This will not play well with Rooted");\n' + uninit
+                    uninit = 'MOZ_ASSERT(mType != eObject, "This will not play well with Rooted");\n' + uninit  # NOQA: E501
                 methods.append(ClassMethod(
                     "SetAs" + vars["name"],
                     vars["structType"] + "&",
                     vars["ctorArgList"],
                     bodyInHeader=not self.ownsMembers,
                     body=body % uninit))
                 if self.ownsMembers:
                     methods.append(vars["setter"])
@@ -10219,17 +10237,17 @@ class CGUnionStruct(CGThing):
                     "ToJSVal",
                     "bool",
                     [
                         Argument("JSContext*", "cx"),
                         Argument("JS::Handle<JSObject*>", "scopeObj"),
                         Argument("JS::MutableHandle<JS::Value>", "rval")
                     ],
                     body=CGSwitch("mType", toJSValCases,
-                                  default=CGGeneric("return false;\n")).define() + "\nreturn false;\n",
+                                  default=CGGeneric("return false;\n")).define() + "\nreturn false;\n",  # NOQA: E501
                     const=True))
 
         constructors = [ctor]
         selfName = CGUnionStruct.unionTypeName(self.type, self.ownsMembers)
         if self.ownsMembers:
             if traceCases:
                 traceBody = CGSwitch("mType", traceCases,
                                      default=CGGeneric("")).define()
@@ -10255,18 +10273,19 @@ class CGUnionStruct(CGThing):
                     body=op_body.define()))
                 disallowCopyConstruction = False
             else:
                 disallowCopyConstruction = True
         else:
             disallowCopyConstruction = True
 
         if self.ownsMembers:
-            friend = "  friend void ImplCycleCollectionUnlink(%s& aUnion);\n" % CGUnionStruct.unionTypeName(
-                self.type, True)
+            friend = ("  friend void ImplCycleCollectionUnlink(%s& aUnion);\n" %
+                      CGUnionStruct.unionTypeName(
+                          self.type, True))
         else:
             friend = "  friend class %sArgument;\n" % str(self.type)
 
         bases = [ClassBase("AllOwningUnionBase")] if self.ownsMembers else []
         return CGClass(selfName,
                        bases=bases,
                        members=members,
                        constructors=constructors,
@@ -10334,21 +10353,22 @@ class CGUnionConversionStruct(CGThing):
         # Argument needs to be a const ref because that's all Maybe<> allows
         ctor = ClassConstructor([Argument("const %s&" % structName, "aUnion")],
                                 bodyInHeader=True,
                                 visibility="public",
                                 explicit=True)
         methods = []
 
         if self.type.hasNullableType:
-            methods.append(ClassMethod("SetNull", "bool", [],
-                                       body=("MOZ_ASSERT(mUnion.mType == mUnion.eUninitialized);\n"
-                                             "mUnion.mType = mUnion.eNull;\n"
-                                             "return true;\n"),
-                                       inline=True, bodyInHeader=True))
+            methods.append(
+                ClassMethod("SetNull", "bool", [],
+                            body=("MOZ_ASSERT(mUnion.mType == mUnion.eUninitialized);\n"
+                                  "mUnion.mType = mUnion.eNull;\n"
+                                  "return true;\n"),
+                            inline=True, bodyInHeader=True))
 
         for t in self.type.flatMemberTypes:
             vars = getUnionTypeTemplateVars(self.type,
                                             t, self.descriptorProvider)
             methods.append(vars["setter"])
             if vars["name"] != "Object":
                 body = fill(
                     """
@@ -10935,17 +10955,17 @@ class CGResolveOwnProperty(CGAbstractSta
                 Argument('JS::Handle<JSObject*>', 'obj'),
                 Argument('JS::Handle<jsid>', 'id'),
                 Argument('JS::MutableHandle<JS::PropertyDescriptor>', 'desc'),
                 ]
         CGAbstractStaticMethod.__init__(self, descriptor, "ResolveOwnProperty",
                                         "bool", args)
 
     def definition_body(self):
-        return "return js::GetProxyHandler(obj)->getOwnPropertyDescriptor(cx, wrapper, id, desc);\n"
+        return "return js::GetProxyHandler(obj)->getOwnPropertyDescriptor(cx, wrapper, id, desc);\n"  # NOQA: E501
 
 
 class CGResolveOwnPropertyViaResolve(CGAbstractBindingMethod):
     """
     An implementation of Xray ResolveOwnProperty stuff for things that have a
     resolve hook.
     """
 
@@ -11376,17 +11396,17 @@ class CGProxyIsProxy(CGAbstractMethod):
     def __init__(self, descriptor):
         args = [Argument('JSObject*', 'obj')]
         CGAbstractMethod.__init__(self, descriptor, "IsProxy", "bool", args, alwaysInline=True)
 
     def declare(self):
         return ""
 
     def definition_body(self):
-        return "return js::IsProxy(obj) && js::GetProxyHandler(obj) == DOMProxyHandler::getInstance();\n"
+        return "return js::IsProxy(obj) && js::GetProxyHandler(obj) == DOMProxyHandler::getInstance();\n"  # NOQA: E501
 
 
 class CGProxyUnwrap(CGAbstractMethod):
     def __init__(self, descriptor):
         args = [Argument('JSObject*', 'obj')]
         CGAbstractMethod.__init__(self, descriptor, "UnwrapProxy",
                                   descriptor.nativeType + '*', args, alwaysInline=True)
 
@@ -11398,33 +11418,32 @@ class CGProxyUnwrap(CGAbstractMethod):
             """
             MOZ_ASSERT(js::IsProxy(obj));
             if (js::GetProxyHandler(obj) != DOMProxyHandler::getInstance()) {
               MOZ_ASSERT(xpc::WrapperFactory::IsXrayWrapper(obj));
               obj = js::UncheckedUnwrap(obj);
             }
             MOZ_ASSERT(IsProxy(obj));
             return static_cast<${type}*>(js::GetProxyReservedSlot(obj, DOM_OBJECT_SLOT).toPrivate());
-            """,
+            """,  # NOQA: E501
             type=self.descriptor.nativeType)
 
 
 class CGDOMJSProxyHandler_getOwnPropDescriptor(ClassMethod):
     def __init__(self, descriptor):
         args = [Argument('JSContext*', 'cx'),
                 Argument('JS::Handle<JSObject*>', 'proxy'),
                 Argument('JS::Handle<jsid>', 'id'),
                 Argument('bool', 'ignoreNamedProps'),
                 Argument('JS::MutableHandle<JS::PropertyDescriptor>', 'desc')]
         ClassMethod.__init__(self, "getOwnPropDescriptor", "bool", args,
                              virtual=True, override=True, const=True)
         self.descriptor = descriptor
 
     def getBody(self):
-        indexedGetter = self.descriptor.operations['IndexedGetter']
         indexedSetter = self.descriptor.operations['IndexedSetter']
 
         if self.descriptor.supportsIndexedProperties():
             readonly = toStringBool(indexedSetter is None)
             fillDescriptor = "FillPropertyDescriptor(desc, proxy, %s);\nreturn true;\n" % readonly
             templateValues = {
                 'jsvalRef': 'desc.value()',
                 'jsvalHandle': 'desc.value()',
@@ -11589,17 +11608,18 @@ class CGDOMJSProxyHandler_defineProperty
                     bool found = false;
                     $*{presenceChecker}
 
                     if (found) {
                       *defined = true;
                       return opresult.failNoNamedSetter();
                     }
                     """,
-                    presenceChecker=CGProxyNamedPresenceChecker(self.descriptor, foundVar="found").define())
+                    presenceChecker=CGProxyNamedPresenceChecker(self.descriptor,
+                                                                foundVar="found").define())
             set += ("return mozilla::dom::DOMProxyHandler::defineProperty(%s);\n" %
                     ", ".join(a.name for a in self.args))
         return set
 
 
 def getDeleterBody(descriptor, type, foundVar=None):
     """
     type should be "Named" or "Indexed"
@@ -11871,31 +11891,33 @@ class CGDOMJSProxyHandler_hasOwn(ClassMe
                   bool found = false;
                   $*{presenceChecker}
 
                   *bp = found;
                   return true;
                 }
 
                 """,
-                presenceChecker=CGProxyIndexedPresenceChecker(self.descriptor, foundVar="found").define())
+                presenceChecker=CGProxyIndexedPresenceChecker(self.descriptor,
+                                                              foundVar="found").define())
         else:
             indexed = ""
 
         if self.descriptor.supportsNamedProperties():
             # If we support indexed properties we always return above for index
             # property names, so no need to check for those here.
             named = fill(
                 """
                 bool found = false;
                 $*{presenceChecker}
 
                 *bp = found;
                 """,
-                presenceChecker=CGProxyNamedPresenceChecker(self.descriptor, foundVar="found").define())
+                presenceChecker=CGProxyNamedPresenceChecker(self.descriptor,
+                                                            foundVar="found").define())
             if not self.descriptor.interface.getExtendedAttribute('OverrideBuiltins'):
                 named = fill(
                     """
                     bool hasOnProto;
                     if (!HasPropertyOnPrototype(cx, proxy, id, &hasOnProto)) {
                       return false;
                     }
                     if (!hasOnProto) {
@@ -12401,18 +12423,18 @@ class CGDescriptor(CGThing):
 
         self._deps = descriptor.interface.getDeps()
 
         cgThings = []
         cgThings.append(CGGeneric(declare="typedef %s NativeType;\n" %
                                   descriptor.nativeType))
         parent = descriptor.interface.parent
         if parent:
-            cgThings.append(CGGeneric("static_assert(IsRefcounted<NativeType>::value == IsRefcounted<%s::NativeType>::value,\n"
-                                      "              \"Can't inherit from an interface with a different ownership model.\");\n" %
+            cgThings.append(CGGeneric("static_assert(IsRefcounted<NativeType>::value == IsRefcounted<%s::NativeType>::value,\n"  # NOQA: E501
+                                      "              \"Can't inherit from an interface with a different ownership model.\");\n" %  # NOQA: E501
                                       toBindingNamespace(descriptor.parentPrototypeName)))
 
         defaultToJSONMethod = None
         crossOriginMethods, crossOriginGetters, crossOriginSetters = set(), set(), set()
         unscopableNames = list()
         for n in descriptor.interface.namedConstructors:
             cgThings.append(CGClassConstructor(descriptor, n,
                                                NamedConstructorName(n)))
@@ -12527,17 +12549,18 @@ class CGDescriptor(CGThing):
             cgThings.append(CGEnumerateHook(descriptor))
 
         if descriptor.hasNamedPropertiesObject:
             cgThings.append(CGGetNamedPropertiesObjectMethod(descriptor))
 
         if descriptor.interface.hasInterfacePrototypeObject():
             cgThings.append(CGPrototypeJSClass(descriptor, properties))
 
-        if ((descriptor.interface.hasInterfaceObject() or descriptor.interface.isNavigatorProperty()) and
+        if ((descriptor.interface.hasInterfaceObject() or
+             descriptor.interface.isNavigatorProperty()) and
             not descriptor.interface.isExternal() and
                 descriptor.isExposedConditionally()):
             cgThings.append(CGConstructorEnabled(descriptor))
 
         if (descriptor.interface.hasMembersInSlots() and
                 descriptor.interface.hasChildInterfaces()):
             raise TypeError("We don't support members in slots on "
                             "non-leaf interfaces like %s" %
@@ -12857,17 +12880,17 @@ class CGDictionary(CGThing):
                 if (!jsapi.Init(cleanGlobal)) {
                   return false;
                 }
                 JSContext* cx = jsapi.cx();
                 JS::Rooted<JS::Value> json(cx);
                 bool ok = ParseJSON(cx, aJSON, &json);
                 NS_ENSURE_TRUE(ok, false);
                 return Init(cx, json);
-                """))
+                """))  # NOQA: E501
 
     def toJSONMethod(self):
         return ClassMethod(
             "ToJSON", "bool",
             [Argument('nsAString&', 'aJSON')],
             body=dedent("""
                 AutoJSAPI jsapi;
                 jsapi.Init();
@@ -13326,17 +13349,17 @@ class CGDictionary(CGThing):
                                     ))
 
         # Now make sure that our successCode can actually break out of the
         # conversion.  This incidentally gives us a scope for 'temp' and
         # 'currentValue'.
         conversion = CGWrapper(
             CGIndenter(conversion),
             pre=("do {\n"
-                 "  // block for our 'break' successCode and scope for 'temp' and 'currentValue'\n"),
+                 "  // block for our 'break' successCode and scope for 'temp' and 'currentValue'\n"),  # NOQA: E501
             post="} while(false);\n")
         if member.canHaveMissingValue():
             # Only do the conversion if we have a value
             conversion = CGIfWrapper(conversion, "%s.WasPassed()" % memberLoc)
         (conditions, conditionsSetup) = getConditionList(member, "cx", "obj")
         if conditionsSetup is not None:
             raise TypeError("We don't support Pref annotations on dictionary "
                             "members.  If we start to, we need to make sure all "
@@ -13507,18 +13530,18 @@ class CGRegisterWorkerBindings(CGAbstrac
         for desc in descriptors:
             bindingNS = toBindingNamespace(desc.name)
             condition = "!%s::GetConstructorObject(aCx)" % bindingNS
             if desc.isExposedConditionally():
                 condition = (
                     "%s::ConstructorEnabled(aCx, aObj) && " % bindingNS
                     + condition)
             conditions.append(condition)
-        lines = [CGIfWrapper(CGGeneric("return false;\n"), condition) for
-                 condition in conditions]
+        lines = [CGIfWrapper(CGGeneric("return false;\n"), cond) for
+                 cond in conditions]
         lines.append(CGGeneric("return true;\n"))
         return CGList(lines, "\n").define()
 
 
 class CGRegisterWorkerDebuggerBindings(CGAbstractMethod):
     def __init__(self, config):
         CGAbstractMethod.__init__(self, None, 'RegisterWorkerDebuggerBindings', 'bool',
                                   [Argument('JSContext*', 'aCx'),
@@ -13533,18 +13556,18 @@ class CGRegisterWorkerDebuggerBindings(C
         for desc in descriptors:
             bindingNS = toBindingNamespace(desc.name)
             condition = "!%s::GetConstructorObject(aCx)" % bindingNS
             if desc.isExposedConditionally():
                 condition = (
                     "%s::ConstructorEnabled(aCx, aObj) && " % bindingNS
                     + condition)
             conditions.append(condition)
-        lines = [CGIfWrapper(CGGeneric("return false;\n"), condition) for
-                 condition in conditions]
+        lines = [CGIfWrapper(CGGeneric("return false;\n"), cond) for
+                 cond in conditions]
         lines.append(CGGeneric("return true;\n"))
         return CGList(lines, "\n").define()
 
 
 class CGRegisterWorkletBindings(CGAbstractMethod):
     def __init__(self, config):
         CGAbstractMethod.__init__(self, None, 'RegisterWorkletBindings', 'bool',
                                   [Argument('JSContext*', 'aCx'),
@@ -13559,18 +13582,18 @@ class CGRegisterWorkletBindings(CGAbstra
         for desc in descriptors:
             bindingNS = toBindingNamespace(desc.name)
             condition = "!%s::GetConstructorObject(aCx)" % bindingNS
             if desc.isExposedConditionally():
                 condition = (
                     "%s::ConstructorEnabled(aCx, aObj) && " % bindingNS
                     + condition)
             conditions.append(condition)
-        lines = [CGIfWrapper(CGGeneric("return false;\n"), condition) for
-                 condition in conditions]
+        lines = [CGIfWrapper(CGGeneric("return false;\n"), cond) for
+                 cond in conditions]
         lines.append(CGGeneric("return true;\n"))
         return CGList(lines, "\n").define()
 
 
 class CGSystemBindingInitIds(CGAbstractMethod):
     def __init__(self):
         CGAbstractMethod.__init__(self, None, 'SystemBindingInitIds', 'bool',
                                   [Argument('JSContext*', 'aCx')])
@@ -13725,17 +13748,17 @@ class CGRegisterGlobalNames(CGAbstractMe
             if not desc.isExposedConditionally():
                 return "nullptr"
             return "%s_Binding::ConstructorEnabled" % desc.name
 
         define = ""
         currentOffset = 0
         for (name, desc) in getGlobalNames(self.config):
             length = len(name)
-            define += "WebIDLGlobalNameHash::Register(%i, %i, %s_Binding::CreateInterfaceObjects, %s, constructors::id::%s);\n" % (
+            define += "WebIDLGlobalNameHash::Register(%i, %i, %s_Binding::CreateInterfaceObjects, %s, constructors::id::%s);\n" % (  # NOQA: E501
                 currentOffset, length, desc.name, getCheck(desc), desc.name)
             currentOffset += length + 1  # Add trailing null.
         return define
 
 
 def dependencySortObjects(objects, dependencyGetter, nameGetter):
     """
     Sort IDL objects with dependencies on each other such that if A
@@ -13975,18 +13998,19 @@ class CGBindingRoot(CGThing):
         bindingHeaders.update(dict.fromkeys(unionImplheaders, True))
         bindingDeclareHeaders["mozilla/dom/UnionMember.h"] = len(unionStructs) > 0
         bindingDeclareHeaders["mozilla/dom/FakeString.h"] = len(unionStructs) > 0
         # BindingUtils.h is only needed for SetToObject.
         # If it stops being inlined or stops calling CallerSubsumes
         # both this bit and the bit in UnionTypes can be removed.
         bindingDeclareHeaders["mozilla/dom/BindingUtils.h"] = any(d.isObject() for t in unionTypes
                                                                   for d in t.flatMemberTypes)
-        bindingDeclareHeaders["mozilla/dom/IterableIterator.h"] = any(d.interface.isIteratorInterface() or
-                                                                      d.interface.isIterable() for d in descriptors)
+        bindingDeclareHeaders["mozilla/dom/IterableIterator.h"] = (
+            any(d.interface.isIteratorInterface() or
+                d.interface.isIterable() for d in descriptors))
 
         def descriptorHasCrossOriginProperties(desc):
             def hasCrossOriginProperty(m):
                 props = memberProperties(m, desc)
                 return (props.isCrossOriginMethod or
                         props.isCrossOriginGetter or
                         props.isCrossOriginSetter)
 
@@ -14062,17 +14086,19 @@ class CGBindingRoot(CGThing):
         callbacks = config.getCallbacks(webIDLFile)
         callbackDescriptors = config.getDescriptors(webIDLFile=webIDLFile,
                                                     isCallback=True)
         jsImplemented = config.getDescriptors(webIDLFile=webIDLFile,
                                               isJSImplemented=True)
         bindingDeclareHeaders["nsWeakReference.h"] = jsImplemented
         bindingDeclareHeaders["mozilla/dom/PrototypeList.h"] = descriptors
         bindingHeaders["nsIGlobalObject.h"] = jsImplemented
-        bindingHeaders["AtomList.h"] = hasNonEmptyDictionaries or jsImplemented or callbackDescriptors
+        bindingHeaders["AtomList.h"] = (hasNonEmptyDictionaries or
+                                        jsImplemented or
+                                        callbackDescriptors)
 
         def descriptorClearsPropsInSlots(descriptor):
             if not descriptor.wrapperCache:
                 return False
             return any(m.isAttr() and m.getExtendedAttribute("StoreInSlot")
                        for m in descriptor.interface.members)
         bindingHeaders["nsJSUtils.h"] = any(descriptorClearsPropsInSlots(d) for d in descriptors)
 
@@ -14343,17 +14369,17 @@ class CGNativeMember(ClassMethod):
             if self.resultAlreadyAddRefed:
                 if isMember:
                     holder = "RefPtr"
                 else:
                     holder = "already_AddRefed"
                 if memberReturnsNewObject(self.member) or isMember:
                     warning = ""
                 else:
-                    warning = "// Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).\n"
+                    warning = "// Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).\n"  # NOQA: E501
                 result = CGWrapper(result,
                                    pre=("%s%s<" % (warning, holder)),
                                    post=">")
             else:
                 result = CGWrapper(result, post="*")
             # Since we always force an owning type for callback return values,
             # our ${declName} is an OwningNonNull or RefPtr.  So we can just
             # .forget() to get our already_AddRefed.
@@ -14568,17 +14594,17 @@ class CGNativeMember(ClassMethod):
                 if optional or isMember:
                     if forceOwningType:
                         typeDecl = "OwningNonNull<%s>"
                     else:
                         typeDecl = "NonNull<%s>"
                 else:
                     typeDecl = "%s&"
             return ((typeDecl %
-                     self.descriptorProvider.getDescriptor(iface.identifier.name).prettyNativeType),
+                     self.descriptorProvider.getDescriptor(iface.identifier.name).prettyNativeType),  # NOQA: E501
                     False, False)
 
         if type.isSpiderMonkeyInterface():
             if not self.spiderMonkeyInterfacesAreStructs:
                 return "JS::Handle<JSObject*>", False, False
 
             # Unroll for the name, in case we're nullable.
             return type.unroll().name, True, True
@@ -14740,17 +14766,18 @@ class CGExampleSetter(CGNativeMember):
         return ''
 
 
 class CGBindingImplClass(CGClass):
     """
     Common codegen for generating a C++ implementation of a WebIDL interface
     """
 
-    def __init__(self, descriptor, cgMethod, cgGetter, cgSetter, wantGetParent=True, wrapMethodName="WrapObject", skipStaticMethods=False):
+    def __init__(self, descriptor, cgMethod, cgGetter, cgSetter, wantGetParent=True,
+                 wrapMethodName="WrapObject", skipStaticMethods=False):
         """
         cgMethod, cgGetter and cgSetter are classes used to codegen methods,
         getters and setters.
         """
         self.descriptor = descriptor
         self._deps = descriptor.interface.getDeps()
 
         iface = descriptor.interface
@@ -14913,20 +14940,20 @@ class CGExampleClass(CGBindingImplClass)
 
         self.parentIface = descriptor.interface.parent
         if self.parentIface:
             self.parentDesc = descriptor.getDescriptor(
                 self.parentIface.identifier.name)
             bases = [ClassBase(self.nativeLeafName(self.parentDesc))]
         else:
             bases = [
-                ClassBase("nsISupports /* or NonRefcountedDOMObject if this is a non-refcounted object */")]
+                ClassBase("nsISupports /* or NonRefcountedDOMObject if this is a non-refcounted object */")]  # NOQA: E501
             if descriptor.wrapperCache:
                 bases.append(ClassBase(
-                    "nsWrapperCache /* Change wrapperCache in the binding configuration if you don't want this */"))
+                    "nsWrapperCache /* Change wrapperCache in the binding configuration if you don't want this */"))  # NOQA: E501
 
         destructorVisibility = "protected"
         if self.parentIface:
             extradeclarations = (
                 "public:\n"
                 "  NS_DECL_ISUPPORTS_INHERITED\n"
                 "  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(%s, %s)\n"
                 "\n" % (self.nativeLeafName(descriptor),
@@ -15005,17 +15032,17 @@ class CGExampleClass(CGBindingImplClass)
             returnType = "bool"
         classImpl = ccImpl + ctordtor + "\n" + dedent("""
             ${returnType}
             ${nativeType}::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto${reflectorArg})
             {
               return ${ifaceName}_Binding::Wrap(aCx, this, aGivenProto${reflectorPassArg});
             }
 
-            """)
+            """)  # NOQA: E501
         return string.Template(classImpl).substitute(
             ifaceName=self.descriptor.name,
             nativeType=self.nativeLeafName(self.descriptor),
             parentType=self.nativeLeafName(self.parentDesc) if self.parentIface else "",
             returnType=returnType,
             reflectorArg=reflectorArg,
             reflectorPassArg=reflectorPassArg)
 
@@ -15066,17 +15093,18 @@ class CGExampleRoot(CGThing):
                               ["nsWrapperCache.h",
                                "nsCycleCollectionParticipant.h",
                                "mozilla/Attributes.h",
                                "mozilla/ErrorResult.h",
                                "mozilla/dom/BindingDeclarations.h",
                                "js/TypeDecls.h"],
                               ["mozilla/dom/%s.h" % interfaceName,
                                ("mozilla/dom/%s" %
-                                CGHeaders.getDeclarationFilename(descriptor.interface))], "", self.root)
+                                CGHeaders.getDeclarationFilename(descriptor.interface))],
+                              "", self.root)
 
         # And now some include guards
         self.root = CGIncludeGuard(interfaceName, self.root)
 
         # And our license block comes before everything else
         self.root = CGWrapper(self.root, pre=dedent("""
             /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
             /* vim:set ts=2 sw=2 sts=2 et cindent: */
@@ -15257,18 +15285,19 @@ class CGJSImplSetter(CGJSImplMember):
                                                                    attr),
                                 (BuiltinTypes[IDLBuiltinType.Types.void],
                                  [FakeArgument(attr.type, attr)]),
                                 descriptor.getExtendedAttributes(attr,
                                                                  setter=True),
                                 passJSBitsAsNeeded=False)
 
     def getImpl(self):
-        callbackArgs = [arg.name for arg in self.getArgs(BuiltinTypes[IDLBuiltinType.Types.void],
-                                                         [FakeArgument(self.member.type, self.member)])]
+        callbackArgs = [arg.name
+                        for arg in self.getArgs(BuiltinTypes[IDLBuiltinType.Types.void],
+                                                [FakeArgument(self.member.type, self.member)])]
         return 'mImpl->%s(%s);\n' % (
             callbackSetterName(self.member, self.descriptorProvider),
             ", ".join(callbackArgs))
 
 
 class CGJSImplClass(CGBindingImplClass):
     def __init__(self, descriptor):
         CGBindingImplClass.__init__(self, descriptor, CGJSImplMethod,
@@ -15276,20 +15305,16 @@ class CGJSImplClass(CGBindingImplClass):
 
         if descriptor.interface.parent:
             parentClass = descriptor.getDescriptor(
                 descriptor.interface.parent.identifier.name).jsImplParent
             baseClasses = [ClassBase(parentClass)]
             isupportsDecl = "NS_DECL_ISUPPORTS_INHERITED\n"
             ccDecl = ("NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(%s, %s)\n" %
                       (descriptor.name, parentClass))
-            constructorBody = dedent("""
-                // Make sure we're an nsWrapperCache already
-                MOZ_ASSERT(static_cast<nsWrapperCache*>(this));
-                """)
             extradefinitions = fill(
                 """
                 NS_IMPL_CYCLE_COLLECTION_INHERITED(${ifaceName}, ${parentClass}, mImpl, mParent)
                 NS_IMPL_ADDREF_INHERITED(${ifaceName}, ${parentClass})
                 NS_IMPL_RELEASE_INHERITED(${ifaceName}, ${parentClass})
                 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(${ifaceName})
                 NS_INTERFACE_MAP_END_INHERITING(${parentClass})
                 """,
@@ -16064,17 +16089,17 @@ class CallbackMember(CGNativeMember):
     def getCallSetup(self):
         if self.needThisHandling:
             # It's been done for us already
             return ""
         callSetup = "CallSetup s(this, aRv"
         if self.rethrowContentException:
             # getArgs doesn't add the aExceptionHandling argument but does add
             # aRealm for us.
-            callSetup += ', "%s", eRethrowContentExceptions, aRealm, /* aIsJSImplementedWebIDL = */ ' % self.getPrettyName()
+            callSetup += ', "%s", eRethrowContentExceptions, aRealm, /* aIsJSImplementedWebIDL = */ ' % self.getPrettyName()  # NOQA: E501
             callSetup += toStringBool(isJSImplementedDescriptor(self.descriptorProvider))
         else:
             callSetup += ', "%s", aExceptionHandling, aRealm' % self.getPrettyName()
         callSetup += ");\n"
         return fill(
             """
             $*{callSetup}
             JSContext* cx = s.GetContext();
@@ -16231,19 +16256,19 @@ class CallbackOperation(CallbackOperatio
     def __init__(self, method, signature, descriptor,
                  spiderMonkeyInterfacesAreStructs):
         self.ensureASCIIName(method)
         self.method = method
         jsName = method.identifier.name
         CallbackOperationBase.__init__(self, signature,
                                        jsName,
                                        MakeNativeName(descriptor.binaryNameFor(jsName)),
-                                       descriptor, descriptor.interface.isSingleOperationInterface(),
-                                       rethrowContentException=descriptor.interface.isJSImplemented(),
-                                       spiderMonkeyInterfacesAreStructs=spiderMonkeyInterfacesAreStructs)
+                                       descriptor, descriptor.interface.isSingleOperationInterface(),  # NOQA: E501
+                                       rethrowContentException=descriptor.interface.isJSImplemented(),  # NOQA: E501
+                                       spiderMonkeyInterfacesAreStructs=spiderMonkeyInterfacesAreStructs)  # NOQA: E501
 
     def getPrettyName(self):
         return "%s.%s" % (self.descriptorProvider.interface.identifier.name,
                           self.method.identifier.name)
 
 
 class CallbackAccessor(CallbackMember):
     """
@@ -16309,17 +16334,17 @@ class CallbackSetter(CallbackAccessor):
             """
             MOZ_ASSERT(argv.length() == 1);
             ${atomCacheName}* atomsCache = GetAtomCache<${atomCacheName}>(cx);
             if ((!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) ||
                 !JS_SetPropertyById(cx, CallbackKnownNotGray(), atomsCache->${attrAtomName}, argv[0])) {
               aRv.Throw(NS_ERROR_UNEXPECTED);
               return${errorReturn};
             }
-            """,
+            """,  # NOQA: E501
             atomCacheName=self.descriptorProvider.interface.identifier.name + "Atoms",
             attrAtomName=CGDictionary.makeIdName(
                 self.descriptorProvider.binaryNameFor(self.attrName)),
             errorReturn=self.getDefaultRetval())
 
     def getArgcDecl(self):
         return None
 
@@ -17052,17 +17077,18 @@ class GlobalGenRoots():
         # Prototype ID enum.
         descriptorsWithPrototype = config.getDescriptors(hasInterfacePrototypeObject=True)
         protos = [d.name for d in descriptorsWithPrototype]
         idEnum = CGNamespacedEnum('id', 'ID', ['_ID_Start'] + protos,
                                   [0, '_ID_Start'])
         idEnum = CGList([idEnum])
 
         def fieldSizeAssert(amount, jitInfoField, message):
-            maxFieldValue = "(uint64_t(1) << (sizeof(((JSJitInfo*)nullptr)->%s) * 8))" % jitInfoField
+            maxFieldValue = ("(uint64_t(1) << (sizeof(((JSJitInfo*)nullptr)->%s) * 8))" %
+                             jitInfoField)
             return CGGeneric(define="static_assert(%s < %s, \"%s\");\n\n"
                              % (amount, maxFieldValue, message))
 
         idEnum.append(fieldSizeAssert("id::_ID_Count", "protoID",
                                       "Too many prototypes!"))
 
         # Wrap all of that in our namespaces.
         idEnum = CGNamespace.build(['mozilla', 'dom', 'prototypes'],
@@ -17533,17 +17559,17 @@ class CGEventMethod(CGNativeMember):
     def define(self, cgClass):
         self.args = list(self.originalArgs)
         if self.isInit:
             return self.defineInit(cgClass)
         members = ""
         holdJS = ""
         iface = self.descriptorProvider.interface
         while iface.identifier.name != "Event":
-            for m in self.descriptorProvider.getDescriptor(iface.identifier.name).interface.members:
+            for m in self.descriptorProvider.getDescriptor(iface.identifier.name).interface.members:  # NOQA: E501
                 if m.isAttr():
                     # We initialize all the other member variables in the
                     # Constructor except those ones coming from the Event.
                     if getattr(m, "originatingInterface",
                                cgClass.descriptor.interface).identifier.name == "Event":
                         continue
                     name = CGDictionary.makeMemberName(m.identifier.name)
                     if m.type.isSequence():
@@ -17684,17 +17710,17 @@ class CGEventClass(CGBindingImplClass):
             parent.identifier.name).nativeType.split('::')[-1]
         self.nativeType = self.descriptor.nativeType.split('::')[-1]
 
         if self.needCC():
             isupportsDecl = fill(
                 """
                 NS_DECL_ISUPPORTS_INHERITED
                 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(${nativeType}, ${parentType})
-                """,
+                """,  # NOQA: E501
                 nativeType=self.nativeType,
                 parentType=self.parentType)
         else:
             isupportsDecl = fill(
                 """
                 NS_INLINE_DECL_REFCOUNTING_INHERITED(${nativeType}, ${parentType})
                 """,
                 nativeType=self.nativeType,
--- a/dom/bindings/Configuration.py
+++ b/dom/bindings/Configuration.py
@@ -381,17 +381,18 @@ class Descriptor(DescriptorProvider):
         elif self.interface.isCallback() or self.interface.isJSImplemented():
             # A copy of CGHeaders.getDeclarationFilename; we can't
             # import it here, sadly.
             # Use our local version of the header, not the exported one, so that
             # test bindings, which don't export, will work correctly.
             basename = os.path.basename(self.interface.filename())
             headerDefault = basename.replace('.webidl', 'Binding.h')
         else:
-            if not self.interface.isExternal() and self.interface.getExtendedAttribute("HeaderFile"):
+            if (not self.interface.isExternal() and
+                self.interface.getExtendedAttribute("HeaderFile")):
                 headerDefault = self.interface.getExtendedAttribute("HeaderFile")[0]
             elif self.interface.isIteratorInterface():
                 headerDefault = "mozilla/dom/IterableIterator.h"
             else:
                 headerDefault = self.nativeType
                 headerDefault = headerDefault.replace("::", "/") + ".h"
         self.headerFile = desc.get('headerFile', headerDefault)
         self.headerIsDefault = self.headerFile == headerDefault
@@ -723,17 +724,18 @@ class Descriptor(DescriptorProvider):
         pref-controlled, has no prototype object, has no static methods or
         attributes and has no parent.  The parent matters because we assert
         things about refcounting that depend on the actual underlying type if we
         have a parent.
 
         """
         return (self.interface.isExternal() or self.concrete or
                 self.interface.hasInterfacePrototypeObject() or
-                any((m.isAttr() or m.isMethod()) and m.isStatic() for m in self.interface.members) or
+                any((m.isAttr() or m.isMethod()) and
+                    m.isStatic() for m in self.interface.members) or
                 self.interface.parent)
 
     def hasThreadChecks(self):
         # isExposedConditionally does not necessarily imply thread checks
         # (since at least [SecureContext] is independent of them), but we're
         # only used to decide whether to include nsThreadUtils.h, so we don't
         # worry about that.
         return ((self.isExposedConditionally() and
--- a/dom/bindings/mozwebidlcodegen/__init__.py
+++ b/dom/bindings/mozwebidlcodegen/__init__.py
@@ -307,17 +307,17 @@ class WebIDLCodegenManager(LoggingMixin)
     def generate_example_files(self, interface):
         """Generates example files for a given interface."""
         from Codegen import CGExampleRoot
 
         root = CGExampleRoot(self.config, interface)
 
         example_paths = self._example_paths(interface)
         for path in example_paths:
-            print "Generating %s" % path
+            print("Generating %s" % path)
 
         return self._maybe_write_codegen(root, *example_paths)
 
     def _parse_webidl(self):
         import WebIDL
         from Configuration import Configuration
 
         self.log(logging.INFO, 'webidl_parse',
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -461,17 +461,17 @@ class IDLObjectWithScope(IDLObjectWithId
 class IDLIdentifierPlaceholder(IDLObjectWithIdentifier):
     def __init__(self, location, identifier):
         assert isinstance(identifier, IDLUnresolvedIdentifier)
         IDLObjectWithIdentifier.__init__(self, location, None, identifier)
 
     def finish(self, scope):
         try:
             scope._lookupIdentifier(self.identifier)
-        except:
+        except Exception:
             raise WebIDLError("Unresolved type '%s'." % self.identifier,
                               [self.location])
 
         obj = self.identifier.resolve(scope, None)
         return scope.lookupIdentifier(obj)
 
 
 class IDLExposureMixins():
@@ -730,17 +730,17 @@ class IDLInterfaceOrNamespace(IDLObjectW
         if isKnownNonPartial:
             self.setNonPartial(location, parent, members)
 
     def ctor(self):
         identifier = IDLUnresolvedIdentifier(self.location, "constructor",
                                              allowForbidden=True)
         try:
             return self._lookupIdentifier(identifier)
-        except:
+        except Exception:
             return None
 
     def isIterable(self):
         return (self.maplikeOrSetlikeOrIterable and
                 self.maplikeOrSetlikeOrIterable.isIterable())
 
     def isIteratorInterface(self):
         return self.iterableInterface is not None
@@ -785,17 +785,17 @@ class IDLInterfaceOrNamespace(IDLObjectW
                 # Check that we only have one interface declaration (currently
                 # there can only be one maplike/setlike declaration per
                 # interface)
                 if self.maplikeOrSetlikeOrIterable:
                     raise WebIDLError("%s declaration used on "
                                       "interface that already has %s "
                                       "declaration" %
                                       (member.maplikeOrSetlikeOrIterableType,
-                                       self.maplikeOrSetlikeOrIterable.maplikeOrSetlikeOrIterableType),
+                                       self.maplikeOrSetlikeOrIterable.maplikeOrSetlikeOrIterableType),  # NOQA: E501
                                       [self.maplikeOrSetlikeOrIterable.location,
                                        member.location])
                 self.maplikeOrSetlikeOrIterable = member
                 # If we've got a maplike or setlike declaration, we'll be building all of
                 # our required methods in Codegen. Generate members now.
                 self.maplikeOrSetlikeOrIterable.expand(self.members, self.isJSImplemented())
 
         # Now that we've merged in our partial interfaces, set the
@@ -980,17 +980,17 @@ class IDLInterfaceOrNamespace(IDLObjectW
                                    iface.identifier.name),
                                   [self.maplikeOrSetlikeOrIterable.location,
                                    iface.maplikeOrSetlikeOrIterable.location])
             additionalMembers = iface.originalMembers
             for additionalMember in additionalMembers:
                 for member in self.members:
                     if additionalMember.identifier.name == member.identifier.name:
                         raise WebIDLError(
-                            "Multiple definitions of %s on %s coming from 'implements' statements" %
+                            "Multiple definitions of %s on %s coming from 'implements' statements" %  # NOQA: E501
                             (member.identifier.name, self),
                             [additionalMember.location, member.location])
             self.members.extend(additionalMembers)
             iface.interfacesImplementingSelf.add(self)
 
         for ancestor in self.getInheritedInterfaces():
             ancestor.interfacesBasedOnSelf.add(self)
             if (ancestor.maplikeOrSetlikeOrIterable is not None and
@@ -1578,17 +1578,18 @@ class IDLInterfaceOrNamespace(IDLObjectW
 
     def hasMembersInSlots(self):
         return self._ownMembersInSlots != 0
 
     conditionExtendedAttributes = ["Pref", "ChromeOnly", "Func",
                                    "SecureContext"]
 
     def isExposedConditionally(self, exclusions=[]):
-        return any(((not a in exclusions) and self.getExtendedAttribute(a)) for a in self.conditionExtendedAttributes)
+        return any(((a not in exclusions) and
+                    self.getExtendedAttribute(a)) for a in self.conditionExtendedAttributes)
 
 
 class IDLInterface(IDLInterfaceOrNamespace):
     def __init__(self, location, parentScope, name, parent, members,
                  isKnownNonPartial, classNameOverride=None,
                  toStringTag=None):
         IDLInterfaceOrNamespace.__init__(self, location, parentScope, name,
                                          parent, members, isKnownNonPartial,
@@ -1622,43 +1623,45 @@ class IDLInterface(IDLInterfaceOrNamespa
                     raise WebIDLError("[NoInterfaceObject] must take no arguments",
                                       [attr.location])
 
                 if self.ctor():
                     raise WebIDLError("Constructor and NoInterfaceObject are incompatible",
                                       [self.location])
 
                 self._noInterfaceObject = True
-            elif identifier == "Constructor" or identifier == "NamedConstructor" or identifier == "ChromeConstructor" or identifier == "HTMLConstructor":
+            elif (identifier == "Constructor" or identifier == "NamedConstructor" or
+                  identifier == "ChromeConstructor" or identifier == "HTMLConstructor"):
                 if identifier == "Constructor" and not self.hasInterfaceObject():
                     raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",
                                       [self.location])
 
                 if identifier == "NamedConstructor" and not attr.hasValue():
-                    raise WebIDLError("NamedConstructor must either take an identifier or take a named argument list",
+                    raise WebIDLError("NamedConstructor must either take an identifier or take a named argument list",  # NOQA: E501
                                       [attr.location])
 
                 if identifier == "ChromeConstructor" and not self.hasInterfaceObject():
                     raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",
                                       [self.location])
 
                 if identifier == "HTMLConstructor":
                     if not self.hasInterfaceObject():
-                        raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",
+                        raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",  # NOQA: E501
                                           [self.location])
 
                     if not attr.noArguments():
                         raise WebIDLError(str(identifier) + " must take no arguments",
                                           [attr.location])
 
                 args = attr.args() if attr.hasArgs() else []
 
                 retType = IDLWrapperType(self.location, self)
 
-                if identifier == "Constructor" or identifier == "ChromeConstructor" or identifier == "HTMLConstructor":
+                if (identifier == "Constructor" or identifier == "ChromeConstructor" or
+                    identifier == "HTMLConstructor"):
                     name = "constructor"
                     allowForbidden = True
                 else:
                     name = attr.value()
                     allowForbidden = False
 
                 methodIdentifier = IDLUnresolvedIdentifier(self.location, name,
                                                            allowForbidden=allowForbidden)
@@ -1672,17 +1675,18 @@ class IDLInterface(IDLInterfaceOrNamespa
                 # extended attributes.
                 method.addExtendedAttributes(
                     [IDLExtendedAttribute(self.location, ("NewObject",)),
                      IDLExtendedAttribute(self.location, ("Throws",))])
                 if identifier == "ChromeConstructor":
                     method.addExtendedAttributes(
                         [IDLExtendedAttribute(self.location, ("ChromeOnly",))])
 
-                if identifier == "Constructor" or identifier == "ChromeConstructor" or identifier == "HTMLConstructor":
+                if (identifier == "Constructor" or identifier == "ChromeConstructor" or
+                    identifier == "HTMLConstructor"):
                     method.resolve(self)
                 else:
                     # We need to detect conflicts for NamedConstructors across
                     # interfaces. We first call resolve on the parentScope,
                     # which will merge all NamedConstructors with the same
                     # identifier accross interfaces as overloads.
                     method.resolve(self.parentScope)
 
@@ -1693,17 +1697,17 @@ class IDLInterface(IDLInterfaceOrNamespa
                     # If the result is not the same as the method we're adding
                     # then it has been added as an overload and we need to check
                     # whether the result is actually one of our existing
                     # NamedConstructors.
                     newMethod = self.parentScope.lookupIdentifier(method.identifier)
                     if newMethod == method:
                         self.namedConstructors.append(method)
                     elif newMethod not in self.namedConstructors:
-                        raise WebIDLError("NamedConstructor conflicts with a NamedConstructor of a different interface",
+                        raise WebIDLError("NamedConstructor conflicts with a NamedConstructor of a different interface",  # NOQA: E501
                                           [method.location, newMethod.location])
             elif (identifier == "ExceptionClass"):
                 if not attr.noArguments():
                     raise WebIDLError("[ExceptionClass] must take no arguments",
                                       [attr.location])
                 if self.parent:
                     raise WebIDLError("[ExceptionClass] must not be specified on "
                                       "an interface with inherited interfaces",
@@ -2213,35 +2217,34 @@ class IDLUnresolvedType(IDLType):
 
     def isComplete(self):
         return False
 
     def complete(self, scope):
         obj = None
         try:
             obj = scope._lookupIdentifier(self.name)
-        except:
+        except Exception:
             raise WebIDLError("Unresolved type '%s'." % self.name,
                               [self.location])
 
         assert obj
         if obj.isType():
-            print obj
+            print(obj)
         assert not obj.isType()
         if obj.isTypedef():
             assert self.name.name == obj.identifier.name
             typedefType = IDLTypedefType(self.location, obj.innerType,
                                          obj.identifier)
             assert not typedefType.isComplete()
             return typedefType.complete(scope)
         elif obj.isCallback() and not obj.isInterface():
             assert self.name.name == obj.identifier.name
             return IDLCallbackType(self.location, obj)
 
-        name = self.name.resolve(scope, None)
         return IDLWrapperType(self.location, obj)
 
     def isDistinguishableFrom(self, other):
         raise TypeError("Can't tell whether an unresolved type is or is not "
                         "distinguishable from other things")
 
 
 class IDLParametrizedType(IDLType):
@@ -2577,17 +2580,18 @@ class IDLUnionType(IDLType):
 
         self.name = "Or".join(typeName(type) for type in self.memberTypes)
         self.flatMemberTypes = list(self.memberTypes)
         i = 0
         while i < len(self.flatMemberTypes):
             if self.flatMemberTypes[i].nullable():
                 if self.hasNullableType:
                     raise WebIDLError("Can't have more than one nullable types in a union",
-                                      [nullableType.location, self.flatMemberTypes[i].location])
+                                      [self.flatMemberTypes[i].location,
+                                       self.flatMemberTypes[i].location])
                 if self.hasDictionaryType():
                     raise WebIDLError("Can't have a nullable type and a "
                                       "dictionary type in a union",
                                       [self._dictionaryType.location,
                                        self.flatMemberTypes[i].location])
                 self.hasNullableType = True
                 nullableType = self.flatMemberTypes[i]
                 self.flatMemberTypes[i] = self.flatMemberTypes[i].inner
@@ -2625,17 +2629,18 @@ class IDLUnionType(IDLType):
         # For every type in otherTypes, check that it's distinguishable from
         # every type in our types
         for u in otherTypes:
             if any(not t.isDistinguishableFrom(u) for t in self.memberTypes):
                 return False
         return True
 
     def isExposedInAllOf(self, exposureSet):
-        # We could have different member types in different globals.  Just make sure that each thing in exposureSet has one of our member types exposed in it.
+        # We could have different member types in different globals.
+        # Just make sure that each thing in exposureSet has one of our member types exposed in it.
         for globalName in exposureSet:
             if not any(t.unroll().isExposedInAllOf(set([globalName])) for t
                        in self.flatMemberTypes):
                 return False
         return True
 
     def hasDictionaryType(self):
         return self._dictionaryType is not None
@@ -3417,17 +3422,17 @@ class IDLValue(IDLObject):
         elif self.type.isString() and type.isByteString():
             # Allow ByteStrings to use a default value like DOMString.
             # No coercion is required as Codegen.py will handle the
             # extra steps. We want to make sure that our string contains
             # only valid characters, so we check that here.
             valid_ascii_lit = " " + string.ascii_letters + string.digits + string.punctuation
             for idx, c in enumerate(self.value):
                 if c not in valid_ascii_lit:
-                    raise WebIDLError("Coercing this string literal %s to a ByteString is not supported yet. "
+                    raise WebIDLError("Coercing this string literal %s to a ByteString is not supported yet. "  # NOQA: E501
                                       "Coercion failed due to an unsupported byte %d at index %d."
                                       % (self.value.__repr__(), ord(c), idx), [location])
 
             return IDLValue(self.location, type, self.value)
 
         raise NoCoercionFoundError("Cannot coerce type %s to type %s." %
                                    (self.type, type), [location])
 
@@ -3474,17 +3479,17 @@ class IDLEmptySequenceValue(IDLObject):
     def coerceToType(self, type, location):
         if type.isUnion():
             # We use the flat member types here, because if we have a nullable
             # member type, or a nested union, we want the type the value
             # actually coerces to, not the nullable or nested union type.
             for subtype in type.unroll().flatMemberTypes:
                 try:
                     return self.coerceToType(subtype, location)
-                except:
+                except Exception:
                     pass
 
         if not type.isSequence():
             raise WebIDLError("Cannot coerce empty sequence value to type %s." % type,
                               [location])
 
         emptySequenceValue = IDLEmptySequenceValue(self.location)
         emptySequenceValue.type = type
@@ -3566,17 +3571,17 @@ class IDLInterfaceMember(IDLObjectWithId
         pass
 
     def getExtendedAttribute(self, name):
         return self._extendedAttrDict.get(name, None)
 
     def finish(self, scope):
         # We better be exposed _somewhere_.
         if (len(self._exposureGlobalNames) == 0):
-            print self.identifier.name
+            print(self.identifier.name)
         assert len(self._exposureGlobalNames) != 0
         IDLExposureMixins.finish(self, scope)
 
     def validate(self):
         if (self.getExtendedAttribute("Pref") and
                 self.exposureSet != set([self._globalScope.primaryGlobalName])):
             raise WebIDLError("[Pref] used on an interface member that is not "
                               "%s-only" % self._globalScope.primaryGlobalName,
@@ -3614,17 +3619,17 @@ class IDLInterfaceMember(IDLObjectWithId
         self.dependsOn = dependsOn
 
     def _setAffects(self, affects):
         if self.affects != "Everything":
             raise WebIDLError("Trying to specify multiple different Affects, "
                               "Pure, or Constant extended attributes for "
                               "attribute", [self.location])
         if affects not in IDLInterfaceMember.AffectsValues:
-            raise WebIDLError("Invalid [Affects=%s] on attribute" % dependsOn,
+            raise WebIDLError("Invalid [Affects=%s] on attribute" % self.dependsOn,
                               [self.location])
         self.affects = affects
 
     def _addAlias(self, alias):
         if alias in self.aliases:
             raise WebIDLError("Duplicate [Alias=%s] on attribute" % alias,
                               [self.location])
         self.aliases.append(alias)
@@ -3861,18 +3866,20 @@ class IDLIterable(IDLMaplikeOrSetlikeOrI
 
 # MaplikeOrSetlike adds ES6 map-or-set-like traits to an interface.
 
 
 class IDLMaplikeOrSetlike(IDLMaplikeOrSetlikeOrIterableBase):
 
     def __init__(self, location, identifier, maplikeOrSetlikeType,
                  readonly, keyType, valueType):
-        IDLMaplikeOrSetlikeOrIterableBase.__init__(self, location, identifier, maplikeOrSetlikeType,
-                                                   keyType, valueType, IDLInterfaceMember.Tags.MaplikeOrSetlike)
+        IDLMaplikeOrSetlikeOrIterableBase.__init__(self, location, identifier,
+                                                   maplikeOrSetlikeType,
+                                                   keyType, valueType,
+                                                   IDLInterfaceMember.Tags.MaplikeOrSetlike)
         self.readonly = readonly
         self.slotIndices = None
 
         # When generating JSAPI access code, we need to know the backing object
         # type prefix to create the correct function. Generate here for reuse.
         if self.isMaplike():
             self.prefix = 'Map'
         elif self.isSetlike():
@@ -4008,17 +4015,17 @@ class IDLConst(IDLInterfaceMember):
         IDLInterfaceMember.finish(self, scope)
 
         if not self.type.isComplete():
             type = self.type.complete(scope)
             if not type.isPrimitive() and not type.isString():
                 locations = [self.type.location, type.location]
                 try:
                     locations.append(type.inner.location)
-                except:
+                except Exception:
                     pass
                 raise WebIDLError("Incorrect type for constant", locations)
             self.type = type
 
         # The value might not match the type
         coercedValue = self.value.coerceToType(self.type, self.location)
         assert coercedValue
 
@@ -4454,17 +4461,18 @@ class IDLAttribute(IDLInterfaceMember):
     def isUnforgeable(self):
         return self._unforgeable
 
     def _getDependentObjects(self):
         return set([self.type])
 
 
 class IDLArgument(IDLObjectWithIdentifier):
-    def __init__(self, location, identifier, type, optional=False, defaultValue=None, variadic=False, dictionaryMember=False):
+    def __init__(self, location, identifier, type, optional=False, defaultValue=None,
+                 variadic=False, dictionaryMember=False):
         IDLObjectWithIdentifier.__init__(self, location, None, identifier)
 
         assert isinstance(type, IDLType)
         self.type = type
 
         self.optional = optional
         self.defaultValue = defaultValue
         self.variadic = variadic
@@ -4859,21 +4867,21 @@ class IDLMethod(IDLInterfaceMember, IDLS
                               "overloads of %s" % method.identifier,
                               [self.location, method.location])
 
         self._overloads.extend(method._overloads)
 
         self._hasOverloads = True
 
         if self.isStatic() != method.isStatic():
-            raise WebIDLError("Overloaded identifier %s appears with different values of the 'static' attribute" % method.identifier,
+            raise WebIDLError("Overloaded identifier %s appears with different values of the 'static' attribute" % method.identifier,  # NOQA: E501
                               [method.location])
 
         if self.isLegacycaller() != method.isLegacycaller():
-            raise WebIDLError("Overloaded identifier %s appears with different values of the 'legacycaller' attribute" % method.identifier,
+            raise WebIDLError("Overloaded identifier %s appears with different values of the 'legacycaller' attribute" % method.identifier,  # NOQA: E501
                               [method.location])
 
         # Can't overload special things!
         assert not self.isGetter()
         assert not method.isGetter()
         assert not self.isSetter()
         assert not method.isSetter()
         assert not self.isDeleter()
@@ -5287,26 +5295,26 @@ class Tokenizer(object):
         "FLOATLITERAL",
         "IDENTIFIER",
         "STRING",
         "WHITESPACE",
         "OTHER"
     ]
 
     def t_FLOATLITERAL(self, t):
-        r'(-?(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+|Infinity))|NaN'
+        r'(-?(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+|Infinity))|NaN'  # NOQA: E501
         t.value = float(t.value)
         return t
 
     def t_INTEGER(self, t):
         r'-?(0([0-7]+|[Xx][0-9A-Fa-f]+)?|[1-9][0-9]*)'
         try:
             # Can't use int(), because that doesn't handle octal properly.
             t.value = parseInt(t.value)
-        except:
+        except Exception:
             raise WebIDLError("Invalid integer literal",
                               [Location(lexer=self.lexer,
                                         lineno=self.lexer.lineno,
                                         lexpos=self.lexer.lexpos,
                                         filename=self._filename)])
         return t
 
     def t_IDENTIFIER(self, t):
@@ -5554,17 +5562,17 @@ class Parser(Tokenizer):
             if existingObj:
                 if not isinstance(existingObj, constructor):
                     raise WebIDLError("%s has the same name as "
                                       "non-%s object" %
                                       (prettyname.capitalize(), prettyname),
                                       [location, existingObj.location])
                 existingObj.setNonPartial(*nonPartialArgs)
                 return existingObj
-        except Exception, ex:
+        except Exception as ex:
             if isinstance(ex, WebIDLError):
                 raise ex
             pass
 
         # True for isKnownNonPartial
         return constructor(*(constructorArgs + [True]))
 
     def p_Interface(self, p):
@@ -5592,17 +5600,17 @@ class Parser(Tokenizer):
             if self.globalScope()._lookupIdentifier(identifier):
                 p[0] = self.globalScope()._lookupIdentifier(identifier)
                 if not isinstance(p[0], IDLExternalInterface):
                     raise WebIDLError("Name collision between external "
                                       "interface declaration for identifier "
                                       "%s and %s" % (identifier.name, p[0]),
                                       [location, p[0].location])
                 return
-        except Exception, ex:
+        except Exception as ex:
             if isinstance(ex, WebIDLError):
                 raise ex
             pass
 
         p[0] = IDLExternalInterface(location, self.globalScope(), identifier)
 
     def p_Namespace(self, p):
         """
@@ -5655,17 +5663,17 @@ class Parser(Tokenizer):
         try:
             nonPartialObject = self.globalScope()._lookupIdentifier(identifier)
             if nonPartialObject:
                 if not isinstance(nonPartialObject, nonPartialConstructor):
                     raise WebIDLError("Partial %s has the same name as "
                                       "non-%s object" %
                                       (prettyname, prettyname),
                                       [location, nonPartialObject.location])
-        except Exception, ex:
+        except Exception as ex:
             if isinstance(ex, WebIDLError):
                 raise ex
             pass
 
         if not nonPartialObject:
             nonPartialObject = nonPartialConstructor(
                 # No members, False for isKnownNonPartial
                 *(nonPartialConstructorArgs + [[], False]))
@@ -5732,17 +5740,17 @@ class Parser(Tokenizer):
         """
             InterfaceMember : Const
                             | AttributeOrOperationOrMaplikeOrSetlikeOrIterable
         """
         p[0] = p[1]
 
     def p_Dictionary(self, p):
         """
-            Dictionary : DICTIONARY IDENTIFIER Inheritance LBRACE DictionaryMembers RBRACE SEMICOLON
+        Dictionary : DICTIONARY IDENTIFIER Inheritance LBRACE DictionaryMembers RBRACE SEMICOLON
         """
         location = self.getLocation(p, 1)
         identifier = IDLUnresolvedIdentifier(self.getLocation(p, 2), p[2])
         members = p[5]
         p[0] = IDLDictionary(location, self.globalScope(), identifier, p[3], members)
 
     def p_DictionaryMembers(self, p):
         """
@@ -6093,17 +6101,17 @@ class Parser(Tokenizer):
             if argType == BuiltinTypes[IDLBuiltinType.Types.domstring]:
                 specialType = IDLMethod.NamedOrIndexed.Named
             elif argType == BuiltinTypes[IDLBuiltinType.Types.unsigned_long]:
                 specialType = IDLMethod.NamedOrIndexed.Indexed
                 if deleter:
                     raise WebIDLError("There is no such thing as an indexed deleter.",
                                       [self.getLocation(p, 1)])
             else:
-                raise WebIDLError("%s has wrong argument type (must be DOMString or UnsignedLong)" %
+                raise WebIDLError("%s has wrong argument type (must be DOMString or UnsignedLong)" %  # NOQA: E501
                                   ("getter" if getter else "deleter"),
                                   [arguments[0].location])
             if arguments[0].optional or arguments[0].variadic:
                 raise WebIDLError("%s cannot have %s argument" %
                                   ("getter" if getter else "deleter",
                                    "optional" if arguments[0].optional else "variadic"),
                                   [arguments[0].location])
         if getter:
@@ -6115,17 +6123,17 @@ class Parser(Tokenizer):
                 raise WebIDLError("setter has wrong number of arguments",
                                   [self.getLocation(p, 2)])
             argType = arguments[0].type
             if argType == BuiltinTypes[IDLBuiltinType.Types.domstring]:
                 specialType = IDLMethod.NamedOrIndexed.Named
             elif argType == BuiltinTypes[IDLBuiltinType.Types.unsigned_long]:
                 specialType = IDLMethod.NamedOrIndexed.Indexed
             else:
-                raise WebIDLError("settter has wrong argument type (must be DOMString or UnsignedLong)",
+                raise WebIDLError("settter has wrong argument type (must be DOMString or UnsignedLong)",  # NOQA: E501
                                   [arguments[0].location])
             if arguments[0].optional or arguments[0].variadic:
                 raise WebIDLError("setter cannot have %s argument" %
                                   ("optional" if arguments[0].optional else "variadic"),
                                   [arguments[0].location])
             if arguments[1].optional or arguments[1].variadic:
                 raise WebIDLError("setter cannot have %s argument" %
                                   ("optional" if arguments[1].optional else "variadic"),
@@ -6627,17 +6635,17 @@ class Parser(Tokenizer):
                     type = IDLTypedefType(self.getLocation(p, 1), obj.innerType,
                                           obj.identifier.name)
                 elif obj.isCallback() and not obj.isInterface():
                     type = IDLCallbackType(self.getLocation(p, 1), obj)
                 else:
                     type = IDLWrapperType(self.getLocation(p, 1), p[1])
                 p[0] = self.handleNullable(type, p[2])
                 return
-        except:
+        except Exception:
             pass
 
         type = IDLUnresolvedType(self.getLocation(p, 1), p[1])
         p[0] = self.handleNullable(type, p[2])
 
     def p_NonAnyTypeDate(self, p):
         """
             NonAnyType : DATE Null
@@ -6880,17 +6888,17 @@ class Parser(Tokenizer):
     def p_IdentifiersEmpty(self, p):
         """
             Identifiers :
         """
         p[0] = []
 
     def p_error(self, p):
         if not p:
-            raise WebIDLError("Syntax Error at end of file. Possibly due to missing semicolon(;), braces(}) or both",
+            raise WebIDLError("Syntax Error at end of file. Possibly due to missing semicolon(;), braces(}) or both",  # NOQA: E501
                               [self._filename])
         else:
             raise WebIDLError("invalid syntax", [Location(
                 self.lexer, p.lineno, p.lexpos, self._filename)])
 
     def __init__(self, outputdir='', lexer=None):
         Tokenizer.__init__(self, outputdir, lexer)
 
@@ -6932,17 +6940,17 @@ class Parser(Tokenizer):
 
     def _installBuiltins(self, scope):
         assert isinstance(scope, IDLScope)
 
         # xrange omits the last value.
         for x in xrange(IDLBuiltinType.Types.ArrayBuffer, IDLBuiltinType.Types.Float64Array + 1):
             builtin = BuiltinTypes[x]
             name = builtin.name
-            typedef = IDLTypedef(BuiltinLocation("<builtin type>"), scope, builtin, name)
+            IDLTypedef(BuiltinLocation("<builtin type>"), scope, builtin, name)
 
     @ staticmethod
     def handleNullable(type, questionMarkLocation):
         if questionMarkLocation is not None:
             type = IDLNullableType(questionMarkLocation, type)
 
         return type
 
@@ -6961,17 +6969,16 @@ class Parser(Tokenizer):
         # iterator interfaces and add them to the productions array.
         interfaceStatements = []
         for p in self._productions:
             if isinstance(p, IDLInterface):
                 interfaceStatements.append(p)
                 if p.identifier.name == "Navigator":
                     navigatorInterface = p
 
-        iterableIteratorIface = None
         for iface in interfaceStatements:
             navigatorProperty = iface.getNavigatorProperty()
             if navigatorProperty:
                 # We're generating a partial interface to add a readonly
                 # property to the Navigator interface for every interface
                 # annotated with NavigatorProperty.
                 partialInterface = IDLPartialInterfaceOrNamespace(
                     iface.location,
@@ -7073,20 +7080,20 @@ def main():
     # Parse the WebIDL.
     parser = Parser(options.cachedir)
     try:
         for filename in fileList:
             fullPath = os.path.normpath(os.path.join(baseDir, filename))
             f = open(fullPath, 'rb')
             lines = f.readlines()
             f.close()
-            print fullPath
+            print(fullPath)
             parser.parse(''.join(lines), fullPath)
         parser.finish()
-    except WebIDLError, e:
+    except WebIDLError as e:
         if options.verbose_errors:
             traceback.print_exc()
         else:
-            print e
+            print(e)
 
 
 if __name__ == '__main__':
     main()
--- a/dom/bindings/parser/tests/test_any_null.py
+++ b/dom/bindings/parser/tests/test_any_null.py
@@ -2,13 +2,13 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface DoubleNull {
               attribute any? foo;
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
--- a/dom/bindings/parser/tests/test_argument_identifier_conflicts.py
+++ b/dom/bindings/parser/tests/test_argument_identifier_conflicts.py
@@ -2,13 +2,13 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface ArgumentIdentifierConflict {
               void foo(boolean arg1, boolean arg1);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
--- a/dom/bindings/parser/tests/test_argument_novoid.py
+++ b/dom/bindings/parser/tests/test_argument_novoid.py
@@ -2,13 +2,13 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface VoidArgument1 {
               void foo(void arg2);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
--- a/dom/bindings/parser/tests/test_arraybuffer.py
+++ b/dom/bindings/parser/tests/test_arraybuffer.py
@@ -1,10 +1,11 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     parser.parse("""
         interface TestArrayBuffer {
           attribute ArrayBuffer bufferAttr;
           void bufferMethod(ArrayBuffer arg1, ArrayBuffer? arg2, sequence<ArrayBuffer> arg3);
 
           attribute ArrayBufferView viewAttr;
           void viewMethod(ArrayBufferView arg1, ArrayBufferView? arg2, sequence<ArrayBufferView> arg3);
@@ -31,17 +32,17 @@ def WebIDLTest(parser, harness):
           void uint32ArrayMethod(Uint32Array arg1, Uint32Array? arg2, sequence<Uint32Array> arg3);
 
           attribute Float32Array float32ArrayAttr;
           void float32ArrayMethod(Float32Array arg1, Float32Array? arg2, sequence<Float32Array> arg3);
 
           attribute Float64Array float64ArrayAttr;
           void float64ArrayMethod(Float64Array arg1, Float64Array? arg2, sequence<Float64Array> arg3);
         };
-    """)
+    """)  # NOQA: E501
 
     results = parser.finish()
 
     iface = results[0]
 
     harness.ok(True, "TestArrayBuffer interface parsed without error")
     harness.check(len(iface.members), 22, "Interface should have twenty two members")
 
@@ -57,21 +58,22 @@ def WebIDLTest(parser, harness):
         (retType, arguments) = method.signatures()[0]
         harness.ok(retType.isVoid(), "Should have a void return type")
         harness.check(len(arguments), 3, "Expect 3 arguments")
 
         harness.check(str(arguments[0].type), t,  "Expect an ArrayBuffer type")
         harness.ok(arguments[0].type.isSpiderMonkeyInterface(), "Should test as a js interface")
 
         harness.check(str(arguments[1].type), t + "OrNull",  "Expect an ArrayBuffer type")
-        harness.ok(arguments[1].type.inner.isSpiderMonkeyInterface(), "Should test as a js interface")
+        harness.ok(arguments[1].type.inner.isSpiderMonkeyInterface(),
+                   "Should test as a js interface")
 
         harness.check(str(arguments[2].type), t + "Sequence",  "Expect an ArrayBuffer type")
-        harness.ok(arguments[2].type.inner.isSpiderMonkeyInterface(), "Should test as a js interface")
-
+        harness.ok(arguments[2].type.inner.isSpiderMonkeyInterface(),
+                   "Should test as a js interface")
 
     checkStuff(members[0],  members[1],  "ArrayBuffer")
     checkStuff(members[2],  members[3],  "ArrayBufferView")
     checkStuff(members[4],  members[5],  "Int8Array")
     checkStuff(members[6],  members[7],  "Uint8Array")
     checkStuff(members[8],  members[9],  "Uint8ClampedArray")
     checkStuff(members[10], members[11], "Int16Array")
     checkStuff(members[12], members[13], "Uint16Array")
--- a/dom/bindings/parser/tests/test_attr.py
+++ b/dom/bindings/parser/tests/test_attr.py
@@ -1,10 +1,11 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     testData = [("::TestAttr%s::b", "b", "Byte%s", False),
                 ("::TestAttr%s::rb", "rb", "Byte%s", True),
                 ("::TestAttr%s::o", "o", "Octet%s", False),
                 ("::TestAttr%s::ro", "ro", "Octet%s", True),
                 ("::TestAttr%s::s", "s", "Short%s", False),
                 ("::TestAttr%s::rs", "rs", "Short%s", True),
                 ("::TestAttr%s::us", "us", "UnsignedShort%s", False),
@@ -78,17 +79,17 @@ def WebIDLTest(parser, harness):
           readonly attribute float? rf;
         };
     """)
 
     results = parser.finish()
 
     def checkAttr(attr, QName, name, type, readonly):
         harness.ok(isinstance(attr, WebIDL.IDLAttribute),
-                  "Should be an IDLAttribute")
+                   "Should be an IDLAttribute")
         harness.ok(attr.isAttr(), "Attr is an Attr")
         harness.ok(not attr.isMethod(), "Attr is not an method")
         harness.ok(not attr.isConst(), "Attr is not a const")
         harness.check(attr.identifier.QName(), QName, "Attr has the right QName")
         harness.check(attr.identifier.name, name, "Attr has the right name")
         harness.check(str(attr.type), type, "Attr has the right type")
         harness.check(attr.readonly, readonly, "Attr's readonly state is correct")
 
@@ -128,50 +129,50 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
           interface A {
             [SetterThrows] readonly attribute boolean foo;
           };
         """)
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should not allow [SetterThrows] on readonly attributes")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
           interface A {
             [Throw] readonly attribute boolean foo;
           };
         """)
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should spell [Throws] correctly")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
           interface A {
             [SameObject] readonly attribute boolean foo;
           };
         """)
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should not allow [SameObject] on attributes not of interface type")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
           interface A {
             [SameObject] readonly attribute A foo;
           };
         """)
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(not threw, "Should allow [SameObject] on attributes of interface type")
--- a/dom/bindings/parser/tests/test_attr_sequence_type.py
+++ b/dom/bindings/parser/tests/test_attr_sequence_type.py
@@ -2,66 +2,66 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface AttrSequenceType {
               attribute sequence<object> foo;
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Attribute type must not be a sequence type")
 
     parser.reset()
 
     threw = False
     try:
         parser.parse("""
             interface AttrUnionWithSequenceType {
               attribute (sequence<object> or DOMString) foo;
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Attribute type must not be a union with a sequence member type")
 
     parser.reset()
 
     threw = False
     try:
         parser.parse("""
             interface AttrNullableUnionWithSequenceType {
               attribute (sequence<object>? or DOMString) foo;
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Attribute type must not be a union with a nullable sequence "
                "member type")
 
     parser.reset()
 
     threw = False
     try:
         parser.parse("""
             interface AttrUnionWithUnionWithSequenceType {
               attribute ((sequence<object> or DOMString) or AttrUnionWithUnionWithSequenceType) foo;
             };
-        """)
+        """)  # NOQA: E501
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Attribute type must not be a union type with a union member "
                "type that has a sequence member type")
--- a/dom/bindings/parser/tests/test_builtin_filename.py
+++ b/dom/bindings/parser/tests/test_builtin_filename.py
@@ -1,11 +1,9 @@
-import WebIDL
-
 def WebIDLTest(parser, harness):
     parser.parse("""
         interface Test {
           attribute long b;
         };
-    """);
+    """)
 
     attr = parser.finish()[0].members[0]
     harness.check(attr.type.filename(), '<builtin>', 'Filename on builtin type')
--- a/dom/bindings/parser/tests/test_builtins.py
+++ b/dom/bindings/parser/tests/test_builtins.py
@@ -1,10 +1,11 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     parser.parse("""
         interface TestBuiltins {
           attribute boolean b;
           attribute byte s8;
           attribute octet u8;
           attribute short s16;
           attribute unsigned short u16;
@@ -26,16 +27,18 @@ def WebIDLTest(parser, harness):
     harness.check(iface.identifier.QName(), "::TestBuiltins", "Interface has the right QName")
     harness.check(iface.identifier.name, "TestBuiltins", "Interface has the right name")
     harness.check(iface.parent, None, "Interface has no parent")
 
     members = iface.members
     harness.check(len(members), 10, "Should be one production")
 
     names = ["b", "s8", "u8", "s16", "u16", "s32", "u32", "s64", "u64", "ts"]
-    types = ["Boolean", "Byte", "Octet", "Short", "UnsignedShort", "Long", "UnsignedLong", "LongLong", "UnsignedLongLong", "UnsignedLongLong"]
+    types = ["Boolean", "Byte", "Octet", "Short", "UnsignedShort", "Long",
+             "UnsignedLong", "LongLong", "UnsignedLongLong", "UnsignedLongLong"]
     for i in range(10):
         attr = members[i]
         harness.ok(isinstance(attr, WebIDL.IDLAttribute), "Should be an IDLAttribute")
-        harness.check(attr.identifier.QName(), "::TestBuiltins::" + names[i], "Attr has correct QName")
+        harness.check(attr.identifier.QName(), "::TestBuiltins::" +
+                      names[i], "Attr has correct QName")
         harness.check(attr.identifier.name, names[i], "Attr has correct name")
         harness.check(str(attr.type), types[i], "Attr type is the correct name")
         harness.ok(attr.type.isPrimitive(), "Should be a primitive type")
--- a/dom/bindings/parser/tests/test_bytestring.py
+++ b/dom/bindings/parser/tests/test_bytestring.py
@@ -1,21 +1,22 @@
 # -*- coding: UTF-8 -*-
 
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     parser.parse("""
         interface TestByteString {
           attribute ByteString bs;
           attribute DOMString ds;
           };
     """)
 
-    results = parser.finish();
+    results = parser.finish()
 
     harness.ok(True, "TestByteString interface parsed without error.")
 
     harness.check(len(results), 1, "Should be one production")
     harness.ok(isinstance(results[0], WebIDL.IDLInterface),
                "Should be an IDLInterface")
     iface = results[0]
     harness.check(iface.identifier.QName(), "::TestByteString", "Interface has the right QName")
@@ -58,42 +59,42 @@ def WebIDLTest(parser, harness):
 
     # Can have optional ByteStrings with default values
     try:
         parser.parse("""
             interface OptionalByteString {
               void passByteString(optional ByteString arg = "hello");
               };
         """)
-        results2 = parser.finish();
+        parser.finish()
     except WebIDL.WebIDLError as e:
         harness.ok(False,
                    "Should not have thrown a WebIDL error for ByteString "
                    "default in dictionary. " + str(e))
 
     # Can have a default ByteString value in a dictionary
     try:
         parser.parse("""
         dictionary OptionalByteStringDict {
           ByteString item = "some string";
         };
         """)
-        results3 = parser.finish();
+        parser.finish()
     except WebIDL.WebIDLError as e:
         harness.ok(False,
                    "Should not have thrown a WebIDL error for ByteString "
                    "default in dictionary. " + str(e))
 
     # Don't allow control characters in ByteString literals
     threw = False
     try:
         parser.parse("""
         dictionary OptionalByteStringDict2 {
           ByteString item = "\x03";
         };
         """)
-        results4 = parser.finish()
+        parser.finish()
     except WebIDL.WebIDLError as e:
         threw = True
 
     harness.ok(threw,
                "Should have thrown a WebIDL error for invalid ByteString "
                "default in dictionary")
--- a/dom/bindings/parser/tests/test_callback.py
+++ b/dom/bindings/parser/tests/test_callback.py
@@ -1,10 +1,11 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     parser.parse("""
         interface TestCallback {
           attribute CallbackType? listener;
         };
 
         callback CallbackType = boolean (unsigned long arg);
     """)
--- a/dom/bindings/parser/tests/test_callback_interface.py
+++ b/dom/bindings/parser/tests/test_callback_interface.py
@@ -1,10 +1,8 @@
-import WebIDL
-
 def WebIDLTest(parser, harness):
     parser.parse("""
         callback interface TestCallbackInterface {
           attribute boolean bool;
         };
     """)
 
     results = parser.finish()
@@ -19,33 +17,33 @@ def WebIDLTest(parser, harness):
         parser.parse("""
             interface TestInterface {
             };
             callback interface TestCallbackInterface : TestInterface {
               attribute boolean bool;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should not allow non-callback parent of callback interface")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface TestInterface : TestCallbackInterface {
             };
             callback interface TestCallbackInterface {
               attribute boolean bool;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should not allow callback parent of non-callback interface")
 
     parser = parser.reset()
     parser.parse("""
         callback interface TestCallbackInterface1 {
           void foo();
@@ -84,11 +82,11 @@ def WebIDLTest(parser, harness):
           void foo();
         };
         callback interface TestCallbackInterface10 : TestCallbackInterface1 {
           void bar();
         };
     """)
     results = parser.finish()
     for (i, iface) in enumerate(results):
-      harness.check(iface.isSingleOperationInterface(), i < 4,
-                    "Interface %s should be a single operation interface" %
-                    iface.identifier.name)
+        harness.check(iface.isSingleOperationInterface(), i < 4,
+                      "Interface %s should be a single operation interface" %
+                      iface.identifier.name)
--- a/dom/bindings/parser/tests/test_cereactions.py
+++ b/dom/bindings/parser/tests/test_cereactions.py
@@ -2,132 +2,133 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface Foo {
               [CEReactions(DOMString a)] void foo(boolean arg2);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown for [CEReactions] with an argument")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface Foo {
               [CEReactions(DOMString b)] readonly attribute boolean bar;
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown for [CEReactions] with an argument")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface Foo {
               [CEReactions] attribute boolean bar;
             };
         """)
 
-        results = parser.finish()
+        parser.finish()
     except Exception, e:
-        harness.ok(False, "Shouldn't have thrown for [CEReactions] used on writable attribute. %s" % e)
+        harness.ok(
+            False, "Shouldn't have thrown for [CEReactions] used on writable attribute. %s" % e)
         threw = True
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface Foo {
               [CEReactions] void foo(boolean arg2);
             };
         """)
 
-        results = parser.finish()
+        parser.finish()
     except Exception, e:
-        harness.ok(False, "Shouldn't have thrown for [CEReactions] used on regular operations. %s" % e)
+        harness.ok(
+            False, "Shouldn't have thrown for [CEReactions] used on regular operations. %s" % e)
         threw = True
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface Foo {
               [CEReactions] readonly attribute boolean A;
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown for [CEReactions] used on a readonly attribute")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [CEReactions]
             interface Foo {
             }
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown for [CEReactions] used on a interface")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
           interface Foo {
             [CEReactions] getter any(DOMString name);
           };
         """)
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should have thrown for [CEReactions] used on a named getter")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
           interface Foo {
             [CEReactions] legacycaller double compute(double x);
           };
         """)
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should have thrown for [CEReactions] used on a legacycaller")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
           interface Foo {
             [CEReactions] stringifier DOMString ();
           };
         """)
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should have thrown for [CEReactions] used on a stringifier")
-
--- a/dom/bindings/parser/tests/test_conditional_dictionary_member.py
+++ b/dom/bindings/parser/tests/test_conditional_dictionary_member.py
@@ -2,17 +2,17 @@ def WebIDLTest(parser, harness):
     parser.parse("""
       dictionary Dict {
         any foo;
         [ChromeOnly] any bar;
       };
     """)
     results = parser.finish()
     harness.check(len(results), 1, "Should have a dictionary")
-    members = results[0].members;
+    members = results[0].members
     harness.check(len(members), 2, "Should have two members")
     # Note that members are ordered lexicographically, so "bar" comes
     # before "foo".
     harness.ok(members[0].getExtendedAttribute("ChromeOnly"),
                "First member is not ChromeOnly")
     harness.ok(not members[1].getExtendedAttribute("ChromeOnly"),
                "Second member is ChromeOnly")
 
@@ -28,83 +28,83 @@ def WebIDLTest(parser, harness):
       };
     """)
     results = parser.finish()
     harness.check(len(results), 2, "Should have a dictionary and an interface")
 
     parser = parser.reset()
     exception = None
     try:
-      parser.parse("""
+        parser.parse("""
         dictionary Dict {
           any foo;
           [ChromeOnly] any bar;
         };
 
         interface Iface {
           [Constant, Cached] readonly attribute Dict dict;
         };
       """)
-      results = parser.finish()
+        results = parser.finish()
     except Exception, exception:
         pass
 
     harness.ok(exception, "Should have thrown.")
     harness.check(exception.message,
                   "[Cached] and [StoreInSlot] must not be used on an attribute "
                   "whose type contains a [ChromeOnly] dictionary member",
                   "Should have thrown the right exception")
 
     parser = parser.reset()
     exception = None
     try:
-      parser.parse("""
+        parser.parse("""
         dictionary ParentDict {
           [ChromeOnly] any bar;
         };
 
         dictionary Dict : ParentDict {
           any foo;
         };
 
         interface Iface {
           [Constant, Cached] readonly attribute Dict dict;
         };
       """)
-      results = parser.finish()
+        results = parser.finish()
     except Exception, exception:
         pass
 
     harness.ok(exception, "Should have thrown (2).")
     harness.check(exception.message,
                   "[Cached] and [StoreInSlot] must not be used on an attribute "
                   "whose type contains a [ChromeOnly] dictionary member",
                   "Should have thrown the right exception (2)")
 
     parser = parser.reset()
     exception = None
     try:
-      parser.parse("""
+        parser.parse("""
         dictionary GrandParentDict {
           [ChromeOnly] any baz;
         };
 
         dictionary ParentDict : GrandParentDict {
           any bar;
         };
 
         dictionary Dict : ParentDict {
           any foo;
         };
 
         interface Iface {
           [Constant, Cached] readonly attribute Dict dict;
         };
       """)
-      results = parser.finish()
+        results = parser.finish()
     except Exception, exception:
         pass
 
     harness.ok(exception, "Should have thrown (3).")
     harness.check(exception.message,
                   "[Cached] and [StoreInSlot] must not be used on an attribute "
                   "whose type contains a [ChromeOnly] dictionary member",
                   "Should have thrown the right exception (3)")
--- a/dom/bindings/parser/tests/test_const.py
+++ b/dom/bindings/parser/tests/test_const.py
@@ -20,16 +20,17 @@ expected = [
     ("::TestConsts::ufl", "ufl", "UnrestrictedFloat", 0.2),
     ("::TestConsts::udb", "udb", "UnrestrictedDouble", 0.2),
     ("::TestConsts::fli", "fli", "Float", 2),
     ("::TestConsts::dbi", "dbi", "Double", 2),
     ("::TestConsts::ufli", "ufli", "UnrestrictedFloat", 2),
     ("::TestConsts::udbi", "udbi", "UnrestrictedDouble", 2),
 ]
 
+
 def WebIDLTest(parser, harness):
     parser.parse("""
         interface TestConsts {
           const byte zero = 0;
           const byte b = -1;
           const octet o = 2;
           const short s = -3;
           const unsigned short us = 0x4;
@@ -72,9 +73,8 @@ def WebIDLTest(parser, harness):
         harness.ok(not const.isMethod(), "Const is not a method")
         harness.check(const.identifier.QName(), QName, "Const has the right QName")
         harness.check(const.identifier.name, name, "Const has the right name")
         harness.check(str(const.type), type, "Const has the right type")
         harness.ok(const.type.isPrimitive(), "All consts should be primitive")
         harness.check(str(const.value.type), str(const.type),
                       "Const's value has the same type as the type")
         harness.check(const.value.value, value, "Const value has the right value.")
-
--- a/dom/bindings/parser/tests/test_constructor.py
+++ b/dom/bindings/parser/tests/test_constructor.py
@@ -1,10 +1,11 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     def checkArgument(argument, QName, name, type, optional, variadic):
         harness.ok(isinstance(argument, WebIDL.IDLArgument),
                    "Should be an IDLArgument")
         harness.check(argument.identifier.QName(), QName, "Argument has the right QName")
         harness.check(argument.identifier.name, name, "Argument has the right name")
         harness.check(str(argument.type), type, "Argument has the right return type")
         harness.check(argument.optional, optional, "Argument has the right optional value")
@@ -20,21 +21,26 @@ def WebIDLTest(parser, harness):
         harness.ok(not method.isAttr(), "Method is not an attr")
         harness.ok(not method.isConst(), "Method is not a const")
         harness.check(method.identifier.QName(), QName, "Method has the right QName")
         harness.check(method.identifier.name, name, "Method has the right name")
         harness.check(method.isStatic(), static, "Method has the correct static value")
         harness.check(method.isGetter(), getter, "Method has the correct getter value")
         harness.check(method.isSetter(), setter, "Method has the correct setter value")
         harness.check(method.isDeleter(), deleter, "Method has the correct deleter value")
-        harness.check(method.isLegacycaller(), legacycaller, "Method has the correct legacycaller value")
-        harness.check(method.isStringifier(), stringifier, "Method has the correct stringifier value")
-        harness.check(method.getExtendedAttribute("ChromeOnly") is not None, chromeOnly, "Method has the correct value for ChromeOnly")
-        harness.check(method.isHTMLConstructor(), htmlConstructor, "Method has the correct htmlConstructor value")
-        harness.check(len(method.signatures()), len(signatures), "Method has the correct number of signatures")
+        harness.check(method.isLegacycaller(), legacycaller,
+                      "Method has the correct legacycaller value")
+        harness.check(method.isStringifier(), stringifier,
+                      "Method has the correct stringifier value")
+        harness.check(method.getExtendedAttribute("ChromeOnly") is not None,
+                      chromeOnly, "Method has the correct value for ChromeOnly")
+        harness.check(method.isHTMLConstructor(), htmlConstructor,
+                      "Method has the correct htmlConstructor value")
+        harness.check(len(method.signatures()), len(signatures),
+                      "Method has the correct number of signatures")
 
         sigpairs = zip(method.signatures(), signatures)
         for (gotSignature, expectedSignature) in sigpairs:
             (gotRetType, gotArgs) = gotSignature
             (expectedRetType, expectedArgs) = expectedSignature
 
             harness.check(str(gotRetType), expectedRetType,
                           "Method has the expected return type.")
@@ -65,23 +71,26 @@ def WebIDLTest(parser, harness):
     harness.ok(isinstance(results[2], WebIDL.IDLInterface),
                "Should be an IDLInterface")
 
     checkMethod(results[0].ctor(), "::TestConstructorNoArgs::constructor",
                 "constructor", [("TestConstructorNoArgs (Wrapper)", [])])
     checkMethod(results[1].ctor(), "::TestConstructorWithArgs::constructor",
                 "constructor",
                 [("TestConstructorWithArgs (Wrapper)",
-                 [("::TestConstructorWithArgs::constructor::name", "name", "String", False, False)])])
+                  [("::TestConstructorWithArgs::constructor::name", "name", "String",
+                    False, False)])])
     checkMethod(results[2].ctor(), "::TestConstructorOverloads::constructor",
                 "constructor",
                 [("TestConstructorOverloads (Wrapper)",
-                 [("::TestConstructorOverloads::constructor::foo", "foo", "Object", False, False)]),
+                  [("::TestConstructorOverloads::constructor::foo", "foo", "Object",
+                    False, False)]),
                  ("TestConstructorOverloads (Wrapper)",
-                 [("::TestConstructorOverloads::constructor::bar", "bar", "Boolean", False, False)])])
+                  [("::TestConstructorOverloads::constructor::bar", "bar", "Boolean",
+                    False, False)])])
 
     parser = parser.reset()
     parser.parse("""
         [ChromeConstructor()]
         interface TestChromeConstructor {
         };
     """)
     results = parser.finish()
@@ -113,160 +122,160 @@ def WebIDLTest(parser, harness):
     try:
         parser.parse("""
         [Constructor(),
          ChromeConstructor(DOMString a)]
         interface TestChromeConstructor {
         };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Can't have both a Constructor and a ChromeConstructor")
 
     # Test HTMLConstructor with argument
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [HTMLConstructor(DOMString a)]
             interface TestHTMLConstructorWithArgs {
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "HTMLConstructor should take no argument")
 
     # Test HTMLConstructor on a callback interface
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [HTMLConstructor]
             callback interface TestHTMLConstructorOnCallbackInterface {
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "HTMLConstructor can't be used on a callback interface")
 
     # Test HTMLConstructor and Constructor
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [Constructor,
              HTMLConstructor]
             interface TestHTMLConstructorAndConstructor {
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Can't have both a Constructor and a HTMLConstructor")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [HTMLConstructor,
              Constructor]
             interface TestHTMLConstructorAndConstructor {
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Can't have both a HTMLConstructor and a Constructor")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [HTMLConstructor,
              Constructor(DOMString a)]
             interface TestHTMLConstructorAndConstructor {
             };
         """)
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Can't have both a HTMLConstructor and a Constructor")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [Constructor(DOMString a),
              HTMLConstructor]
             interface TestHTMLConstructorAndConstructor {
             };
         """)
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Can't have both a HTMLConstructor and a Constructor")
 
     # Test HTMLConstructor and ChromeConstructor
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [ChromeConstructor,
              HTMLConstructor]
             interface TestHTMLConstructorAndChromeConstructor {
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Can't have both a HTMLConstructor and a ChromeConstructor")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [HTMLConstructor,
              ChromeConstructor]
             interface TestHTMLConstructorAndChromeConstructor {
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Can't have both a HTMLConstructor and a ChromeConstructor")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [ChromeConstructor(DOMString a),
              HTMLConstructor]
             interface TestHTMLConstructorAndChromeConstructor {
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [HTMLConstructor,
              ChromeConstructor(DOMString a)]
             interface TestHTMLConstructorAndChromeConstructor {
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Can't have both a HTMLConstructor and a ChromeConstructor")
--- a/dom/bindings/parser/tests/test_constructor_no_interface_object.py
+++ b/dom/bindings/parser/tests/test_constructor_no_interface_object.py
@@ -2,32 +2,32 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             [Constructor, NoInterfaceObject]
             interface TestConstructorNoInterfaceObject {
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             [NoInterfaceObject, Constructor]
             interface TestConstructorNoInterfaceObject {
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     parser = parser.reset()
 
     parser.parse("""
         [NoInterfaceObject, NamedConstructor=FooBar]
@@ -41,29 +41,29 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             [NoInterfaceObject, HTMLConstructor]
             interface TestHTMLConstructorNoInterfaceObject {
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     parser = parser.reset()
 
     threw = False
     try:
         parser.parse("""
             [HTMLConstructor, NoInterfaceObject]
             interface TestHTMLConstructorNoInterfaceObject {
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
--- a/dom/bindings/parser/tests/test_deduplicate.py
+++ b/dom/bindings/parser/tests/test_deduplicate.py
@@ -1,15 +1,13 @@
-import WebIDL
-
 def WebIDLTest(parser, harness):
     parser.parse("""
         interface Foo;
         interface Bar;
         interface Foo;
-        """);
+        """)
 
     results = parser.finish()
 
     # There should be no duplicate interfaces in the result.
     expectedNames = sorted(['Foo', 'Bar'])
     actualNames = sorted(map(lambda iface: iface.identifier.name, results))
     harness.check(actualNames, expectedNames, "Parser shouldn't output duplicate names.")
--- a/dom/bindings/parser/tests/test_dictionary.py
+++ b/dom/bindings/parser/tests/test_dictionary.py
@@ -6,18 +6,18 @@ def WebIDLTest(parser, harness):
       };
       dictionary Dict1 {
         long parent;
         double otherParent;
       };
     """)
     results = parser.finish()
 
-    dict1 = results[1];
-    dict2 = results[0];
+    dict1 = results[1]
+    dict2 = results[0]
 
     harness.check(len(dict1.members), 2, "Dict1 has two members")
     harness.check(len(dict2.members), 2, "Dict2 has four members")
 
     harness.check(dict1.members[0].identifier.name, "otherParent",
                   "'o' comes before 'p'")
     harness.check(dict1.members[1].identifier.name, "parent",
                   "'o' really comes before 'p'")
@@ -32,17 +32,17 @@ def WebIDLTest(parser, harness):
     try:
         parser.parse("""
           dictionary Dict {
             long prop = 5;
             long prop;
           };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should not allow name duplication in a dictionary")
 
     # Now reset our parser again
     parser = parser.reset()
     threw = False
     try:
@@ -53,144 +53,144 @@ def WebIDLTest(parser, harness):
           dictionary Dict2 : Dict3 {
             long prop2;
           };
           dictionary Dict3 {
             double prop;
           };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should not allow name duplication in a dictionary and "
                "its ancestor")
 
     # More reset
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
           interface Iface {};
           dictionary Dict : Iface {
             long prop;
           };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should not allow non-dictionary parents for dictionaries")
 
     # Even more reset
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary A : B {};
             dictionary B : A {};
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should not allow cycles in dictionary inheritance chains")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary A {
               [TreatNullAs=EmptyString] DOMString foo;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
-    harness.ok(threw, "Should not allow [TreatNullAs] on dictionary members");
+    harness.ok(threw, "Should not allow [TreatNullAs] on dictionary members")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary A {
             };
             interface X {
               void doFoo(A arg);
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Trailing dictionary arg must be optional")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary A {
             };
             interface X {
               void doFoo((A or DOMString) arg);
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Trailing union arg containing a dictionary must be optional")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary A {
             };
             interface X {
               void doFoo(A arg1, optional long arg2);
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Dictionary arg followed by optional arg must be optional")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary A {
             };
             interface X {
               void doFoo(A arg1, optional long arg2, long arg3);
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(not threw,
                "Dictionary arg followed by non-optional arg doesn't have to be optional")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary A {
             };
             interface X {
               void doFoo((A or DOMString) arg1, optional long arg2);
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Union arg containing dictionary followed by optional arg must "
                "be optional")
 
     parser = parser.reset()
     parser.parse("""
@@ -209,65 +209,65 @@ def WebIDLTest(parser, harness):
         parser.parse("""
             dictionary A {
             };
             interface X {
               void doFoo(optional A? arg1);
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Dictionary arg must not be nullable")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary A {
             };
             interface X {
               void doFoo(optional (A or long)? arg1);
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Dictionary arg must not be in a nullable union")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary A {
             };
             interface X {
               void doFoo(optional (A or long?) arg1);
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw,
                "Dictionary must not be in a union with a nullable type")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary A {
             };
             interface X {
               void doFoo(optional (long? or A) arg1);
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw,
                "A nullable type must not be in a union with a dictionary")
 
     parser = parser.reset()
     parser.parse("""
         dictionary A {
         };
@@ -304,17 +304,17 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             dictionary Foo {
               Foo foo;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Member type must not be its Dictionary.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
@@ -330,77 +330,77 @@ def WebIDLTest(parser, harness):
               long a;
             };
 
             dictionary Foo {
               Foo1 b;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Member type must not be a Dictionary that "
                       "inherits from its Dictionary.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary Foo {
               (Foo or DOMString)[]? b;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Member type must not be a Nullable type "
                       "whose inner type includes its Dictionary.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary Foo {
               (DOMString or Foo) b;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Member type must not be a Union type, one of "
                       "whose member types includes its Dictionary.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary Foo {
               sequence<sequence<sequence<Foo>>> c;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Member type must not be a Sequence type "
                       "whose element type includes its Dictionary.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary Foo {
               (DOMString or Foo)[] d;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Member type must not be an Array type "
                       "whose element type includes its Dictionary.")
 
     parser = parser.reset()
     threw = False
     try:
@@ -417,41 +417,41 @@ def WebIDLTest(parser, harness):
               short c;
             };
 
             dictionary Foo1 : Foo2 {
               long a;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Member type must not be a Dictionary, one of whose "
                       "members or inherited members has a type that includes "
                       "its Dictionary.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary Foo {
             };
 
             dictionary Bar {
               Foo? d;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Member type must not be a nullable dictionary")
 
-    parser = parser.reset();
+    parser = parser.reset()
     parser.parse("""
         dictionary Foo {
           unrestricted float  urFloat = 0;
           unrestricted float  urFloat2 = 1.1;
           unrestricted float  urFloat3 = -1.1;
           unrestricted float? urFloat4 = null;
           unrestricted float  infUrFloat = Infinity;
           unrestricted float  negativeInfUrFloat = -Infinity;
@@ -464,92 +464,91 @@ def WebIDLTest(parser, harness):
           unrestricted double  infUrDouble = Infinity;
           unrestricted double  negativeInfUrDouble = -Infinity;
           unrestricted double  nanUrDouble = NaN;
         };
     """)
     results = parser.finish()
     harness.ok(True, "Parsing default values for unrestricted types succeeded.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary Foo {
               double f = Infinity;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Only unrestricted values can be initialized to Infinity")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary Foo {
               double f = -Infinity;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Only unrestricted values can be initialized to -Infinity")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary Foo {
               double f = NaN;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Only unrestricted values can be initialized to NaN")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary Foo {
               float f = Infinity;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Only unrestricted values can be initialized to Infinity")
 
-
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary Foo {
               float f = -Infinity;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Only unrestricted values can be initialized to -Infinity")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary Foo {
               float f = NaN;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Only unrestricted values can be initialized to NaN")
--- a/dom/bindings/parser/tests/test_distinguishability.py
+++ b/dom/bindings/parser/tests/test_distinguishability.py
@@ -1,11 +1,12 @@
 def firstArgType(method):
     return method.signatures()[0][1][0].type
 
+
 def WebIDLTest(parser, harness):
     parser.parse("""
       dictionary Dict {
       };
       callback interface Foo {
       };
       interface Bar {
         // Bit of a pain to get things that have dictionary types
@@ -22,31 +23,31 @@ def WebIDLTest(parser, harness):
     dictMethod = iface.members[0]
     ifaceMethod = iface.members[1]
     nullableUnionMethod = iface.members[2]
     nullableIfaceMethod = iface.members[3]
 
     dictType = firstArgType(dictMethod)
     ifaceType = firstArgType(ifaceMethod)
 
-    harness.ok(dictType.isDictionary(), "Should have dictionary type");
-    harness.ok(ifaceType.isInterface(), "Should have interface type");
-    harness.ok(ifaceType.isCallbackInterface(), "Should have callback interface type");
+    harness.ok(dictType.isDictionary(), "Should have dictionary type")
+    harness.ok(ifaceType.isInterface(), "Should have interface type")
+    harness.ok(ifaceType.isCallbackInterface(), "Should have callback interface type")
 
     harness.ok(not dictType.isDistinguishableFrom(ifaceType),
                "Dictionary not distinguishable from callback interface")
     harness.ok(not ifaceType.isDistinguishableFrom(dictType),
                "Callback interface not distinguishable from dictionary")
 
     nullableUnionType = firstArgType(nullableUnionMethod)
     nullableIfaceType = firstArgType(nullableIfaceMethod)
 
-    harness.ok(nullableUnionType.isUnion(), "Should have union type");
-    harness.ok(nullableIfaceType.isInterface(), "Should have interface type");
-    harness.ok(nullableIfaceType.nullable(), "Should have nullable type");
+    harness.ok(nullableUnionType.isUnion(), "Should have union type")
+    harness.ok(nullableIfaceType.isInterface(), "Should have interface type")
+    harness.ok(nullableIfaceType.nullable(), "Should have nullable type")
 
     harness.ok(not nullableUnionType.isDistinguishableFrom(nullableIfaceType),
                "Nullable type not distinguishable from union with nullable "
                "member type")
     harness.ok(not nullableIfaceType.isDistinguishableFrom(nullableUnionType),
                "Union with nullable member type not distinguishable from "
                "nullable type")
 
@@ -119,17 +120,17 @@ def WebIDLTest(parser, harness):
           interface TestIface {
             void method(long arg1, TestIface arg2);
             void method(long arg1, long arg2);
             void method(any arg1,  Dummy arg2);
             void method(DOMString arg1, DOMString arg2, DOMString arg3);
           };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should throw when args before the distinguishing arg are not "
                "all the same type")
 
     parser = parser.reset()
     threw = False
@@ -139,78 +140,78 @@ def WebIDLTest(parser, harness):
           interface TestIface {
             void method(long arg1, TestIface arg2);
             void method(long arg1, long arg2);
             void method(any arg1,  DOMString arg2);
             void method(DOMString arg1, DOMString arg2, DOMString arg3);
           };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should throw when there is no distinguishing index")
 
     # Now let's test our whole distinguishability table
-    argTypes = [ "long", "short", "long?", "short?", "boolean",
-                 "boolean?", "DOMString", "ByteString", "Enum", "Enum2",
-                 "Interface", "Interface?",
-                 "AncestorInterface", "UnrelatedInterface",
-                 "ImplementedInterface", "CallbackInterface",
-                 "CallbackInterface?", "CallbackInterface2",
-                 "object", "Callback", "Callback2", "optional Dict",
-                 "optional Dict2", "sequence<long>", "sequence<short>",
-                 "record<DOMString, object>",
-                 "record<USVString, Dict>",
-                 "record<ByteString, long>",
-                 "Date", "Date?", "any",
-                 "Promise<any>", "Promise<any>?",
-                 "USVString", "ArrayBuffer", "ArrayBufferView", "SharedArrayBuffer",
-                 "Uint8Array", "Uint16Array",
-                 "(long or Callback)", "optional (long or Dict)",
-    ]
+    argTypes = ["long", "short", "long?", "short?", "boolean",
+                "boolean?", "DOMString", "ByteString", "Enum", "Enum2",
+                "Interface", "Interface?",
+                "AncestorInterface", "UnrelatedInterface",
+                "ImplementedInterface", "CallbackInterface",
+                "CallbackInterface?", "CallbackInterface2",
+                "object", "Callback", "Callback2", "optional Dict",
+                "optional Dict2", "sequence<long>", "sequence<short>",
+                "record<DOMString, object>",
+                "record<USVString, Dict>",
+                "record<ByteString, long>",
+                "Date", "Date?", "any",
+                "Promise<any>", "Promise<any>?",
+                "USVString", "ArrayBuffer", "ArrayBufferView", "SharedArrayBuffer",
+                "Uint8Array", "Uint16Array",
+                "(long or Callback)", "optional (long or Dict)",
+                ]
     # When we can parse Date, we need to add it here.
     # XXXbz we can, and should really do that...
 
     # Try to categorize things a bit to keep list lengths down
     def allBut(list1, list2):
         return [a for a in list1 if a not in list2 and
                 (a != "any" and a != "Promise<any>" and a != "Promise<any>?")]
-    unions = [ "(long or Callback)", "optional (long or Dict)" ]
-    numerics = [ "long", "short", "long?", "short?" ]
-    booleans = [ "boolean", "boolean?" ]
+    unions = ["(long or Callback)", "optional (long or Dict)"]
+    numerics = ["long", "short", "long?", "short?"]
+    booleans = ["boolean", "boolean?"]
     primitives = numerics + booleans
     nonNumerics = allBut(argTypes, numerics + unions)
     nonBooleans = allBut(argTypes, booleans)
-    strings = [ "DOMString", "ByteString", "Enum", "Enum2", "USVString" ]
+    strings = ["DOMString", "ByteString", "Enum", "Enum2", "USVString"]
     nonStrings = allBut(argTypes, strings)
     nonObjects = primitives + strings
-    objects = allBut(argTypes, nonObjects )
     bufferSourceTypes = ["ArrayBuffer", "ArrayBufferView", "Uint8Array", "Uint16Array"]
     sharedBufferSourceTypes = ["SharedArrayBuffer"]
-    interfaces = [ "Interface", "Interface?", "AncestorInterface",
-                   "UnrelatedInterface", "ImplementedInterface" ] + bufferSourceTypes + sharedBufferSourceTypes
+    interfaces = (["Interface", "Interface?", "AncestorInterface",
+                  "UnrelatedInterface", "ImplementedInterface"] +
+                  bufferSourceTypes + sharedBufferSourceTypes)
     nullables = (["long?", "short?", "boolean?", "Interface?",
                   "CallbackInterface?", "optional Dict", "optional Dict2",
                   "Date?", "any", "Promise<any>?"] +
-                 allBut(unions, [ "(long or Callback)" ]))
-    dates = [ "Date", "Date?" ]
-    sequences = [ "sequence<long>", "sequence<short>" ]
+                 allBut(unions, ["(long or Callback)"]))
+    dates = ["Date", "Date?"]
+    sequences = ["sequence<long>", "sequence<short>"]
     nonUserObjects = nonObjects + interfaces + dates + sequences
     otherObjects = allBut(argTypes, nonUserObjects + ["object"])
     notRelatedInterfaces = (nonObjects + ["UnrelatedInterface"] +
-                            otherObjects + dates + sequences + bufferSourceTypes + sharedBufferSourceTypes)
-    records = [ "record<DOMString, object>", "record<USVString, Dict>",
-                "record<ByteString, long>" ]
+                            otherObjects + dates + sequences + bufferSourceTypes +
+                            sharedBufferSourceTypes)
 
     # Build a representation of the distinguishability table as a dict
     # of dicts, holding True values where needed, holes elsewhere.
-    data = dict();
+    data = dict()
     for type in argTypes:
         data[type] = dict()
+
     def setDistinguishable(type, types):
         for other in types:
             data[type][other] = True
 
     setDistinguishable("long", nonNumerics)
     setDistinguishable("short", nonNumerics)
     setDistinguishable("long?", allBut(nonNumerics, nullables))
     setDistinguishable("short?", allBut(nonNumerics, nullables))
@@ -243,19 +244,21 @@ def WebIDLTest(parser, harness):
     setDistinguishable("record<USVString, Dict>", nonUserObjects)
     setDistinguishable("record<ByteString, long>", nonUserObjects)
     setDistinguishable("Date", allBut(argTypes, dates + ["object"]))
     setDistinguishable("Date?", allBut(argTypes, dates + nullables + ["object"]))
     setDistinguishable("any", [])
     setDistinguishable("Promise<any>", [])
     setDistinguishable("Promise<any>?", [])
     setDistinguishable("ArrayBuffer", allBut(argTypes, ["ArrayBuffer", "object"]))
-    setDistinguishable("ArrayBufferView", allBut(argTypes, ["ArrayBufferView", "Uint8Array", "Uint16Array", "object"]))
+    setDistinguishable("ArrayBufferView", allBut(
+        argTypes, ["ArrayBufferView", "Uint8Array", "Uint16Array", "object"]))
     setDistinguishable("Uint8Array", allBut(argTypes, ["ArrayBufferView", "Uint8Array", "object"]))
-    setDistinguishable("Uint16Array", allBut(argTypes, ["ArrayBufferView", "Uint16Array", "object"]))
+    setDistinguishable("Uint16Array", allBut(
+        argTypes, ["ArrayBufferView", "Uint16Array", "object"]))
     setDistinguishable("SharedArrayBuffer", allBut(argTypes, ["SharedArrayBuffer", "object"]))
     setDistinguishable("(long or Callback)",
                        allBut(nonUserObjects, numerics))
     setDistinguishable("optional (long or Dict)",
                        allBut(nonUserObjects, numerics + nullables))
 
     def areDistinguishable(type1, type2):
         return data[type1].get(type2, False)
@@ -281,24 +284,26 @@ def WebIDLTest(parser, harness):
         methodTemplate = """
             void myMethod(%s arg);"""
         methods = (methodTemplate % type1) + (methodTemplate % type2)
         idl = idlTemplate % methods
         parser = parser.reset()
         threw = False
         try:
             parser.parse(idl)
-            results = parser.finish()
-        except:
+            parser.finish()
+        except Exception:
             threw = True
 
         if areDistinguishable(type1, type2):
             harness.ok(not threw,
-                       "Should not throw for '%s' and '%s' because they are distinguishable" % (type1, type2))
+                       "Should not throw for '%s' and '%s' because they are distinguishable" %
+                       (type1, type2))
         else:
             harness.ok(threw,
-                       "Should throw for '%s' and '%s' because they are not distinguishable" % (type1, type2))
+                       "Should throw for '%s' and '%s' because they are not distinguishable" %
+                       (type1, type2))
 
     # Enumerate over everything in both orders, since order matters in
     # terms of our implementation of distinguishability checks
     for type1 in argTypes:
         for type2 in argTypes:
             checkDistinguishability(parser, type1, type2)
--- a/dom/bindings/parser/tests/test_double_null.py
+++ b/dom/bindings/parser/tests/test_double_null.py
@@ -2,13 +2,13 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface DoubleNull {
               attribute byte?? foo;
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
--- a/dom/bindings/parser/tests/test_duplicate_qualifiers.py
+++ b/dom/bindings/parser/tests/test_duplicate_qualifiers.py
@@ -2,55 +2,55 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface DuplicateQualifiers1 {
               getter getter byte foo(unsigned long index);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface DuplicateQualifiers2 {
               setter setter byte foo(unsigned long index, byte value);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface DuplicateQualifiers4 {
               deleter deleter byte foo(unsigned long index);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface DuplicateQualifiers5 {
               getter deleter getter byte foo(unsigned long index);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
--- a/dom/bindings/parser/tests/test_empty_enum.py
+++ b/dom/bindings/parser/tests/test_empty_enum.py
@@ -1,14 +1,12 @@
-import WebIDL
-
 def WebIDLTest(parser, harness):
     try:
         parser.parse("""
             enum TestEmptyEnum {
             };
         """)
 
         harness.ok(False, "Should have thrown!")
-    except:
+    except Exception:
         harness.ok(True, "Parsing TestEmptyEnum enum should fail")
 
-    results = parser.finish()
+    parser.finish()
--- a/dom/bindings/parser/tests/test_empty_sequence_default_value.py
+++ b/dom/bindings/parser/tests/test_empty_sequence_default_value.py
@@ -1,45 +1,45 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface X {
               const sequence<long> foo = [];
             };
         """)
 
         results = parser.finish()
-    except Exception,x:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Constant cannot have [] as a default value")
 
     parser = parser.reset()
 
     parser.parse("""
         interface X {
           void foo(optional sequence<long> arg = []);
         };
     """)
-    results = parser.finish();
+    results = parser.finish()
 
     harness.ok(isinstance(
         results[0].members[0].signatures()[0][1][0].defaultValue,
         WebIDL.IDLEmptySequenceValue),
                "Should have IDLEmptySequenceValue as default value of argument")
 
     parser = parser.reset()
 
     parser.parse("""
         dictionary X {
           sequence<long> foo = [];
         };
     """)
-    results = parser.finish();
+    results = parser.finish()
 
     harness.ok(isinstance(results[0].members[0].defaultValue,
                           WebIDL.IDLEmptySequenceValue),
                "Should have IDLEmptySequenceValue as default value of "
                "dictionary member")
-
--- a/dom/bindings/parser/tests/test_enum.py
+++ b/dom/bindings/parser/tests/test_enum.py
@@ -1,10 +1,11 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     parser.parse("""
         enum TestEnum {
           "",
           "foo",
           "bar"
         };
 
@@ -70,17 +71,17 @@ def WebIDLTest(parser, harness):
             "b",
             "c"
           };
           interface TestInterface {
             void foo(optional Enum e = "d");
           };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should not allow a bogus default value for an enum")
 
     # Now reset our parser
     parser = parser.reset()
     parser.parse("""
       enum Enum {
--- a/dom/bindings/parser/tests/test_enum_duplicate_values.py
+++ b/dom/bindings/parser/tests/test_enum_duplicate_values.py
@@ -1,13 +1,11 @@
-import WebIDL
-
 def WebIDLTest(parser, harness):
     try:
         parser.parse("""
             enum TestEnumDuplicateValue {
               "",
               ""
             };
         """)
         harness.ok(False, "Should have thrown!")
-    except:
+    except Exception:
         harness.ok(True, "Enum TestEnumDuplicateValue should throw")
--- a/dom/bindings/parser/tests/test_error_colno.py
+++ b/dom/bindings/parser/tests/test_error_colno.py
@@ -1,18 +1,19 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     # Check that error messages put the '^' in the right place.
 
     threw = False
     input = 'interface ?'
     try:
         parser.parse(input)
-        results = parser.finish()
+        parser.finish()
     except WebIDL.WebIDLError, e:
         threw = True
         lines = str(e).split('\n')
 
         harness.check(len(lines), 3, 'Expected number of lines in error message')
         harness.check(lines[1], input, 'Second line shows error')
         harness.check(lines[2], ' ' * (len(input) - 1) + '^',
                       'Correct column pointer in error message')
--- a/dom/bindings/parser/tests/test_error_lineno.py
+++ b/dom/bindings/parser/tests/test_error_lineno.py
@@ -1,28 +1,30 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     # Check that error messages put the '^' in the right place.
 
     threw = False
     input = """\
 // This is a comment.
 interface Foo {
 };
 
 /* This is also a comment. */
 interface ?"""
     try:
         parser.parse(input)
-        results = parser.finish()
+        parser.finish()
     except WebIDL.WebIDLError, e:
         threw = True
         lines = str(e).split('\n')
 
         harness.check(len(lines), 3, 'Expected number of lines in error message')
-        harness.ok(lines[0].endswith('line 6:10'), 'First line of error should end with "line 6:10", but was "%s".' % lines[0])
-        harness.check(lines[1], 'interface ?', 'Second line of error message is the line which caused the error.')
+        harness.ok(lines[0].endswith('line 6:10'),
+                   'First line of error should end with "line 6:10", but was "%s".' % lines[0])
+        harness.check(lines[1], 'interface ?',
+                      'Second line of error message is the line which caused the error.')
         harness.check(lines[2], ' ' * (len('interface ?') - 1) + '^',
                       'Correct column pointer in error message.')
 
     harness.ok(threw, "Should have thrown.")
-
--- a/dom/bindings/parser/tests/test_exposed_extended_attribute.py
+++ b/dom/bindings/parser/tests/test_exposed_extended_attribute.py
@@ -1,10 +1,11 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     parser.parse("""
       [PrimaryGlobal] interface Foo {};
       [Global=(Bar1,Bar2)] interface Bar {};
       [Global=Baz2] interface Baz {};
 
       [Exposed=(Foo,Bar1)]
       interface Iface {
@@ -17,20 +18,20 @@ def WebIDLTest(parser, harness):
       [Exposed=Foo]
       partial interface Iface {
         void method2();
       };
     """)
 
     results = parser.finish()
 
-    harness.check(len(results), 5, "Should know about five things");
+    harness.check(len(results), 5, "Should know about five things")
     iface = results[3]
     harness.ok(isinstance(iface, WebIDL.IDLInterface),
-               "Should have an interface here");
+               "Should have an interface here")
     members = iface.members
     harness.check(len(members), 3, "Should have three members")
 
     harness.ok(members[0].exposureSet == set(["Foo", "Bar"]),
                "method1 should have the right exposure set")
     harness.ok(members[0]._exposureGlobalNames == set(["Foo", "Bar1"]),
                "method1 should have the right exposure global names")
 
@@ -56,20 +57,20 @@ def WebIDLTest(parser, harness):
       [Global=Baz2] interface Baz {};
 
       interface Iface2 {
         void method3();
       };
     """)
     results = parser.finish()
 
-    harness.check(len(results), 4, "Should know about four things");
+    harness.check(len(results), 4, "Should know about four things")
     iface = results[3]
     harness.ok(isinstance(iface, WebIDL.IDLInterface),
-               "Should have an interface here");
+               "Should have an interface here")
     members = iface.members
     harness.check(len(members), 1, "Should have one member")
 
     harness.ok(members[0].exposureSet == set(["Foo"]),
                "method3 should have the right exposure set")
     harness.ok(members[0]._exposureGlobalNames == set(["Foo"]),
                "method3 should have the right exposure global names")
 
@@ -92,20 +93,20 @@ def WebIDLTest(parser, harness):
       [Exposed=(Foo,Bar1)]
       interface Mixin {
         void method5();
       };
 
       Iface3 implements Mixin;
     """)
     results = parser.finish()
-    harness.check(len(results), 6, "Should know about six things");
+    harness.check(len(results), 6, "Should know about six things")
     iface = results[3]
     harness.ok(isinstance(iface, WebIDL.IDLInterface),
-               "Should have an interface here");
+               "Should have an interface here")
     members = iface.members
     harness.check(len(members), 2, "Should have two members")
 
     harness.ok(members[0].exposureSet == set(["Foo"]),
                "method4 should have the right exposure set")
     harness.ok(members[0]._exposureGlobalNames == set(["Foo"]),
                "method4 should have the right exposure global names")
 
@@ -119,65 +120,65 @@ def WebIDLTest(parser, harness):
     try:
         parser.parse("""
             [Exposed=Foo]
             interface Bar {
             };
         """)
 
         results = parser.finish()
-    except Exception,x:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown on invalid Exposed value on interface.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface Bar {
               [Exposed=Foo]
               readonly attribute bool attr;
             };
         """)
 
         results = parser.finish()
-    except Exception,x:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown on invalid Exposed value on attribute.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface Bar {
               [Exposed=Foo]
               void operation();
             };
         """)
 
         results = parser.finish()
-    except Exception,x:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown on invalid Exposed value on operation.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface Bar {
               [Exposed=Foo]
               const long constant = 5;
             };
         """)
 
         results = parser.finish()
-    except Exception,x:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown on invalid Exposed value on constant.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
@@ -187,17 +188,17 @@ def WebIDLTest(parser, harness):
             [Exposed=Foo]
             interface Baz {
               [Exposed=Bar]
               void method();
             };
         """)
 
         results = parser.finish()
-    except Exception,x:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown on member exposed where its interface is not.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
@@ -211,12 +212,12 @@ def WebIDLTest(parser, harness):
 
             [Exposed=Bar]
             interface Mixin {};
 
             Baz implements Mixin;
         """)
 
         results = parser.finish()
-    except Exception,x:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown on LHS of implements being exposed where RHS is not.")
--- a/dom/bindings/parser/tests/test_extended_attributes.py
+++ b/dom/bindings/parser/tests/test_extended_attributes.py
@@ -1,10 +1,8 @@
-import WebIDL
-
 def WebIDLTest(parser, harness):
     parser.parse("""
         [NoInterfaceObject]
         interface TestExtendedAttr {
           [Unforgeable] readonly attribute byte b;
         };
     """)
 
@@ -35,17 +33,17 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface TestLenientThis2 {
               [LenientThis=something] attribute byte b;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "[LenientThis] must take no arguments")
 
     parser = parser.reset()
     parser.parse("""
         interface TestClamp {
           void testClamp([Clamp] long foo);
@@ -65,17 +63,17 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface TestClamp2 {
               void testClamp([Clamp=something] long foo);
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "[Clamp] must take no arguments")
 
     parser = parser.reset()
     parser.parse("""
         interface TestEnforceRange {
           void testEnforceRange([EnforceRange] long foo);
@@ -95,13 +93,12 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface TestEnforceRange2 {
               void testEnforceRange([EnforceRange=something] long foo);
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "[EnforceRange] must take no arguments")
-    
--- a/dom/bindings/parser/tests/test_float_types.py
+++ b/dom/bindings/parser/tests/test_float_types.py
@@ -1,10 +1,11 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     parser.parse("""
         typedef float myFloat;
         typedef unrestricted float myUnrestrictedFloat;
         interface FloatTypes {
           attribute float f;
           attribute unrestricted float uf;
           attribute double d;
@@ -63,63 +64,63 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface FloatTypes {
               [LenientFloat]
               long m(float arg);
             };
         """)
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "[LenientFloat] only allowed on void methods")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface FloatTypes {
               [LenientFloat]
               void m(unrestricted float arg);
             };
         """)
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "[LenientFloat] only allowed on methods with unrestricted float args")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface FloatTypes {
               [LenientFloat]
               void m(sequence<unrestricted float> arg);
             };
         """)
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "[LenientFloat] only allowed on methods with unrestricted float args (2)")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface FloatTypes {
               [LenientFloat]
               void m((unrestricted float or FloatTypes) arg);
             };
         """)
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "[LenientFloat] only allowed on methods with unrestricted float args (3)")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface FloatTypes {
               [LenientFloat]
               readonly attribute float foo;
             };
         """)
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "[LenientFloat] only allowed on writable attributes")
--- a/dom/bindings/parser/tests/test_forward_decl.py
+++ b/dom/bindings/parser/tests/test_forward_decl.py
@@ -1,15 +1,13 @@
-import WebIDL
-
 def WebIDLTest(parser, harness):
     parser.parse("""
         interface ForwardDeclared;
         interface ForwardDeclared;
 
         interface TestForwardDecl {
           attribute ForwardDeclared foo;
         };
     """)
 
-    results = parser.finish()
+    parser.finish()
 
     harness.ok(True, "TestForwardDeclared interface parsed without error.")
--- a/dom/bindings/parser/tests/test_global_extended_attr.py
+++ b/dom/bindings/parser/tests/test_global_extended_attr.py
@@ -20,17 +20,17 @@ def WebIDLTest(parser, harness):
         parser.parse("""
           [Global]
           interface Foo {
             getter any(DOMString name);
             setter void(DOMString name, any arg);
           };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should have thrown for [Global] used on an interface with a "
                "named setter")
 
     parser = parser.reset()
     threw = False
@@ -38,33 +38,33 @@ def WebIDLTest(parser, harness):
         parser.parse("""
           [Global]
           interface Foo {
             getter any(DOMString name);
             deleter void(DOMString name);
           };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should have thrown for [Global] used on an interface with a "
                "named deleter")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
           [Global, OverrideBuiltins]
           interface Foo {
           };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should have thrown for [Global] used on an interface with a "
                "[OverrideBuiltins]")
 
     parser = parser.reset()
     threw = False
@@ -73,17 +73,17 @@ def WebIDLTest(parser, harness):
           [Global]
           interface Foo : Bar {
           };
           [OverrideBuiltins]
           interface Bar {
           };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should have thrown for [Global] used on an interface with an "
                "[OverrideBuiltins] ancestor")
 
     parser = parser.reset()
     threw = False
@@ -91,14 +91,14 @@ def WebIDLTest(parser, harness):
         parser.parse("""
           [Global]
           interface Foo {
           };
           interface Bar : Foo {
           };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should have thrown for [Global] used on an interface with a "
                "descendant")
--- a/dom/bindings/parser/tests/test_identifier_conflict.py
+++ b/dom/bindings/parser/tests/test_identifier_conflict.py
@@ -1,39 +1,36 @@
 # Import the WebIDL module, so we can do isinstance checks and whatnot
-import WebIDL
-
 def WebIDLTest(parser, harness):
     try:
         parser.parse("""
             enum Foo { "a" };
             interface Foo;
         """)
-        results = parser.finish()
+        parser.finish()
         harness.ok(False, "Should fail to parse")
     except Exception, e:
         harness.ok("Name collision" in e.message,
                    "Should have name collision for interface")
 
     parser = parser.reset()
     try:
         parser.parse("""
             dictionary Foo { long x; };
             enum Foo { "a" };
         """)
-        results = parser.finish()
+        parser.finish()
         harness.ok(False, "Should fail to parse")
     except Exception, e:
         harness.ok("Name collision" in e.message,
                    "Should have name collision for dictionary")
 
     parser = parser.reset()
     try:
         parser.parse("""
             enum Foo { "a" };
             enum Foo { "b" };
         """)
-        results = parser.finish()
+        parser.finish()
         harness.ok(False, "Should fail to parse")
     except Exception, e:
         harness.ok("Multiple unresolvable definitions" in e.message,
                    "Should have name collision for dictionary")
-
--- a/dom/bindings/parser/tests/test_implements.py
+++ b/dom/bindings/parser/tests/test_implements.py
@@ -1,26 +1,27 @@
 # Import the WebIDL module, so we can do isinstance checks and whatnot
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     # Basic functionality
     threw = False
     try:
         parser.parse("""
             A implements B;
             interface B {
               attribute long x;
             };
             interface A {
               attribute long y;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(not threw, "Should not have thrown on implements statement "
                "before interfaces")
     harness.check(len(results), 3, "We have three statements")
     harness.ok(isinstance(results[1], WebIDL.IDLInterface), "B is an interface")
     harness.check(len(results[1].members), 1, "B has one member")
     A = results[2]
@@ -37,17 +38,17 @@ def WebIDLTest(parser, harness):
             interface D {
               attribute long x;
             };
             interface C {
               attribute long x;
             };
         """)
         parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown on implemented interface duplicating "
                "a name on base interface")
 
     # Same, but duplicated across implemented interfaces
     threw = False
     try:
@@ -58,17 +59,17 @@ def WebIDLTest(parser, harness):
               attribute long x;
             };
             interface G {
               attribute long x;
             };
             interface E {};
         """)
         parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown on implemented interfaces "
                "duplicating each other's member names")
 
     # Same, but duplicated across indirectly implemented interfaces
     threw = False
     try:
@@ -82,17 +83,17 @@ def WebIDLTest(parser, harness):
             interface L {
               attribute long x;
             };
             interface I {};
             interface J : L {};
             interface H {};
         """)
         parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown on indirectly implemented interfaces "
                "duplicating each other's member names")
 
     # Same, but duplicated across an implemented interface and its parent
     threw = False
     try:
@@ -102,17 +103,17 @@ def WebIDLTest(parser, harness):
               attribute long x;
             };
             interface N : O {
               attribute long x;
             };
             interface M {};
         """)
         parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown on implemented interface and its "
                "ancestor duplicating member names")
 
     # Reset the parser so we can actually find things where we expect
     # them in the list
     parser = parser.reset()
@@ -128,17 +129,17 @@ def WebIDLTest(parser, harness):
             interface Q {};
             interface R {};
             interface S {
               attribute long x;
             };
             interface P {};
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(not threw, "Diamond inheritance is fine")
     harness.check(results[6].identifier.name, "S", "We should be looking at 'S'")
     harness.check(len(results[6].members), 1, "S should have one member")
     harness.check(results[6].members[0].identifier.name, "x",
                   "S's member should be 'x'")
 
@@ -148,17 +149,17 @@ def WebIDLTest(parser, harness):
         parser.parse("""
             interface TestInterface {
             };
             callback interface TestCallbackInterface {
             };
             TestInterface implements TestCallbackInterface;
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should not allow callback interfaces on the right-hand side "
                "of 'implements'")
 
     parser = parser.reset()
     threw = False
@@ -166,35 +167,35 @@ def WebIDLTest(parser, harness):
         parser.parse("""
             interface TestInterface {
             };
             callback interface TestCallbackInterface {
             };
             TestCallbackInterface implements TestInterface;
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should not allow callback interfaces on the left-hand side of "
                "'implements'")
-    
+
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface TestInterface {
             };
             dictionary Dict {
             };
             Dict implements TestInterface;
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should not allow non-interfaces on the left-hand side "
                "of 'implements'")
 
     parser = parser.reset()
     threw = False
@@ -202,15 +203,14 @@ def WebIDLTest(parser, harness):
         parser.parse("""
             interface TestInterface {
             };
             dictionary Dict {
             };
             TestInterface implements Dict;
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should not allow non-interfaces on the right-hand side "
                "of 'implements'")
-
--- a/dom/bindings/parser/tests/test_incomplete_parent.py
+++ b/dom/bindings/parser/tests/test_incomplete_parent.py
@@ -1,10 +1,8 @@
-import WebIDL
-
 def WebIDLTest(parser, harness):
     parser.parse("""
         interface TestIncompleteParent : NotYetDefined {
           void foo();
         };
 
         interface NotYetDefined : EvenHigherOnTheChain {
         };
--- a/dom/bindings/parser/tests/test_incomplete_types.py
+++ b/dom/bindings/parser/tests/test_incomplete_types.py
@@ -1,10 +1,11 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     parser.parse("""
         interface TestIncompleteTypes {
           attribute FooInterface attr1;
 
           FooInterface method1(FooInterface arg);
         };
 
@@ -14,17 +15,18 @@ def WebIDLTest(parser, harness):
 
     results = parser.finish()
 
     harness.ok(True, "TestIncompleteTypes interface parsed without error.")
     harness.check(len(results), 2, "Should be two productions.")
     iface = results[0]
     harness.ok(isinstance(iface, WebIDL.IDLInterface),
                "Should be an IDLInterface")
-    harness.check(iface.identifier.QName(), "::TestIncompleteTypes", "Interface has the right QName")
+    harness.check(iface.identifier.QName(), "::TestIncompleteTypes",
+                  "Interface has the right QName")
     harness.check(iface.identifier.name, "TestIncompleteTypes", "Interface has the right name")
     harness.check(len(iface.members), 2, "Expect 2 members")
 
     attr = iface.members[0]
     harness.ok(isinstance(attr, WebIDL.IDLAttribute),
                "Should be an IDLAttribute")
     method = iface.members[1]
     harness.ok(isinstance(method, WebIDL.IDLMethod),
--- a/dom/bindings/parser/tests/test_interface.py
+++ b/dom/bindings/parser/tests/test_interface.py
@@ -1,10 +1,11 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     parser.parse("interface Foo { };")
     results = parser.finish()
     harness.ok(True, "Empty interface parsed without error.")
     harness.check(len(results), 1, "Should be one production")
     harness.ok(isinstance(results[0], WebIDL.IDLInterface),
                "Should be an IDLInterface")
     iface = results[0]
@@ -27,17 +28,17 @@ def WebIDLTest(parser, harness):
     parser = parser.reset()
     parser.parse("""
         interface QNameBase {
           attribute long foo;
         };
 
         interface QNameDerived : QNameBase {
           attribute long long foo;
-          attribute byte bar;          
+          attribute byte bar;
         };
     """)
     results = parser.finish()
     harness.check(len(results), 2, "Should be two productions")
     harness.ok(isinstance(results[0], WebIDL.IDLInterface),
                "Should be an IDLInterface")
     harness.ok(isinstance(results[1], WebIDL.IDLInterface),
                "Should be an IDLInterface")
@@ -56,156 +57,157 @@ def WebIDLTest(parser, harness):
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A : B {};
             interface B : A {};
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should not allow cycles in interface inheritance chains")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A : C {};
             interface C : B {};
             interface B : A {};
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should not allow indirect cycles in interface inheritance chains")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A {};
             interface B {};
             A implements B;
             B implements A;
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should not allow cycles via implements")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A {};
             interface C {};
             interface B {};
             A implements C;
             C implements B;
             B implements A;
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should not allow indirect cycles via implements")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A : B {};
             interface B {};
             B implements A;
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should not allow inheriting from an interface that implements us")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A : B {};
             interface B {};
             interface C {};
             B implements C;
             C implements A;
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
-    harness.ok(threw, "Should not allow inheriting from an interface that indirectly implements us")
+    harness.ok(threw, "Should not allow inheriting from an interface that indirectly implements us")  # NOQA: E501
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A : B {};
             interface B : C {};
             interface C {};
             C implements A;
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
-    harness.ok(threw, "Should not allow indirectly inheriting from an interface that implements us")
+    harness.ok(threw, "Should not allow indirectly inheriting from an interface that implements us")  # NOQA: E501
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A : B {};
             interface B : C {};
             interface C {};
             interface D {};
             C implements D;
             D implements A;
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
-    harness.ok(threw, "Should not allow indirectly inheriting from an interface that indirectly implements us")
+    harness.ok(
+        threw, "Should not allow indirectly inheriting from an interface that indirectly implements us")  # NOQA: E501
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A;
             interface B : A {};
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
-    harness.ok(threw, "Should not allow inheriting from an interface that is only forward declared")
+    harness.ok(threw, "Should not allow inheriting from an interface that is only forward declared")  # NOQA: E501
 
     parser = parser.reset()
     parser.parse("""
         [Constructor(long arg)]
         interface A {
             readonly attribute boolean x;
             void foo();
         };
         [Constructor]
         partial interface A {
             readonly attribute boolean y;
             void foo(long arg);
         };
-    """);
-    results = parser.finish();
+    """)
+    results = parser.finish()
     harness.check(len(results), 2,
                   "Should have two results with partial interface")
     iface = results[0]
     harness.check(len(iface.members), 3,
                   "Should have three members with partial interface")
     harness.check(iface.members[0].identifier.name, "x",
                   "First member should be x with partial interface")
     harness.check(iface.members[1].identifier.name, "foo",
@@ -224,18 +226,18 @@ def WebIDLTest(parser, harness):
             readonly attribute boolean y;
             void foo(long arg);
         };
         [Constructor(long arg)]
         interface A {
             readonly attribute boolean x;
             void foo();
         };
-    """);
-    results = parser.finish();
+    """)
+    results = parser.finish()
     harness.check(len(results), 2,
                   "Should have two results with reversed partial interface")
     iface = results[1]
     harness.check(len(iface.members), 3,
                   "Should have three members with reversed partial interface")
     harness.check(iface.members[0].identifier.name, "x",
                   "First member should be x with reversed partial interface")
     harness.check(iface.members[1].identifier.name, "foo",
@@ -254,51 +256,51 @@ def WebIDLTest(parser, harness):
             interface A {
                 readonly attribute boolean x;
             };
             interface A {
                 readonly attribute boolean y;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should not allow two non-partial interfaces with the same name")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             partial interface A {
                 readonly attribute boolean x;
             };
             partial interface A {
                 readonly attribute boolean y;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw,
                "Must have a non-partial interface for a given name")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary  A {
                 boolean x;
             };
             partial interface A {
                 readonly attribute boolean y;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should not allow a name collision between partial interface "
                "and other object")
 
     parser = parser.reset()
     threw = False
     try:
@@ -306,49 +308,49 @@ def WebIDLTest(parser, harness):
             dictionary A {
                 boolean x;
             };
             interface A {
                 readonly attribute boolean y;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should not allow a name collision between interface "
                "and other object")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary A {
                 boolean x;
             };
             interface A;
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should not allow a name collision between external interface "
                "and other object")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A {
                 readonly attribute boolean x;
             };
             interface A;
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should not allow a name collision between external interface "
                "and interface")
 
     parser = parser.reset()
     parser.parse("""
         interface A;
@@ -365,12 +367,12 @@ def WebIDLTest(parser, harness):
     try:
         parser.parse("""
             [SomeRandomAnnotation]
             interface A {
                 readonly attribute boolean y;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should not allow unknown extended attributes on interfaces")
--- a/dom/bindings/parser/tests/test_interface_const_identifier_conflicts.py
+++ b/dom/bindings/parser/tests/test_interface_const_identifier_conflicts.py
@@ -3,13 +3,13 @@ def WebIDLTest(parser, harness):
     try:
         parser.parse("""
             interface IdentifierConflict {
               const byte thing1 = 1;
               const unsigned long thing1 = 1;
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
--- a/dom/bindings/parser/tests/test_interface_identifier_conflicts_across_members.py
+++ b/dom/bindings/parser/tests/test_interface_identifier_conflicts_across_members.py
@@ -3,58 +3,58 @@ def WebIDLTest(parser, harness):
     try:
         parser.parse("""
             interface IdentifierConflictAcrossMembers1 {
               const byte thing1 = 1;
               readonly attribute long thing1;
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface IdentifierConflictAcrossMembers2 {
               readonly attribute long thing1;
               const byte thing1 = 1;
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface IdentifierConflictAcrossMembers3 {
               getter boolean thing1(DOMString name);
               readonly attribute long thing1;
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface IdentifierConflictAcrossMembers1 {
               const byte thing1 = 1;
               long thing1();
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
--- a/dom/bindings/parser/tests/test_interface_maplikesetlikeiterable.py
+++ b/dom/bindings/parser/tests/test_interface_maplikesetlikeiterable.py
@@ -1,10 +1,11 @@
 import WebIDL
-import traceback
+
+
 def WebIDLTest(parser, harness):
 
     def shouldPass(prefix, iface, expectedMembers, numProductions=1):
         p = parser.reset()
         p.parse(iface)
         results = p.finish()
         harness.check(len(results), numProductions,
                       "%s - Should have production count %d" % (prefix, numProductions))
@@ -627,17 +628,17 @@ def WebIDLTest(parser, harness):
                [Unforgeable]
                attribute double size;
                };
                interface Foo2 : Foo1 {
                maplike<long, long>;
                };
                """)
 
-    shouldFail("Inheritance of multi-level unforgeable attribute collision with child maplike/setlike",
+    shouldFail("Inheritance of multi-level unforgeable attribute collision with child maplike/setlike",  # NOQA: E501
                """
                interface Foo1 {
                [Unforgeable]
                attribute double size;
                };
                interface Foo2 : Foo1 {
                };
                interface Foo3 : Foo2 {
--- a/dom/bindings/parser/tests/test_lenientSetter.py
+++ b/dom/bindings/parser/tests/test_lenientSetter.py
@@ -1,19 +1,20 @@
 # 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/.
 
+
 def should_throw(parser, harness, message, code):
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse(code)
         parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown: %s" % message)
 
 
 def WebIDLTest(parser, harness):
     # The [LenientSetter] extended attribute MUST take no arguments.
     should_throw(parser, harness, "no arguments", """
--- a/dom/bindings/parser/tests/test_method.py
+++ b/dom/bindings/parser/tests/test_method.py
@@ -1,10 +1,11 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     parser.parse("""
         interface TestMethods {
           void basic();
           static void basicStatic();
           void basicWithSimpleArgs(boolean arg1, byte arg2, unsigned long arg3);
           boolean basicBoolean();
           static boolean basicStaticBoolean();
@@ -49,19 +50,22 @@ def WebIDLTest(parser, harness):
         harness.ok(not method.isAttr(), "Method is not an attr")
         harness.ok(not method.isConst(), "Method is not a const")
         harness.check(method.identifier.QName(), QName, "Method has the right QName")
         harness.check(method.identifier.name, name, "Method has the right name")
         harness.check(method.isStatic(), static, "Method has the correct static value")
         harness.check(method.isGetter(), getter, "Method has the correct getter value")
         harness.check(method.isSetter(), setter, "Method has the correct setter value")
         harness.check(method.isDeleter(), deleter, "Method has the correct deleter value")
-        harness.check(method.isLegacycaller(), legacycaller, "Method has the correct legacycaller value")
-        harness.check(method.isStringifier(), stringifier, "Method has the correct stringifier value")
-        harness.check(len(method.signatures()), len(signatures), "Method has the correct number of signatures")
+        harness.check(method.isLegacycaller(), legacycaller,
+                      "Method has the correct legacycaller value")
+        harness.check(method.isStringifier(), stringifier,
+                      "Method has the correct stringifier value")
+        harness.check(len(method.signatures()), len(signatures),
+                      "Method has the correct number of signatures")
 
         sigpairs = zip(method.signatures(), signatures)
         for (gotSignature, expectedSignature) in sigpairs:
             (gotRetType, gotArgs) = gotSignature
             (expectedRetType, expectedArgs) = expectedSignature
 
             harness.check(str(gotRetType), expectedRetType,
                           "Method has the expected return type.")
@@ -70,108 +74,115 @@ def WebIDLTest(parser, harness):
                 (QName, name, type, optional, variadic) = expectedArgs[i]
                 checkArgument(gotArgs[i], QName, name, type, optional, variadic)
 
     checkMethod(methods[0], "::TestMethods::basic", "basic", [("Void", [])])
     checkMethod(methods[1], "::TestMethods::basicStatic", "basicStatic",
                 [("Void", [])], static=True)
     checkMethod(methods[2], "::TestMethods::basicWithSimpleArgs",
                 "basicWithSimpleArgs",
-       [("Void",
-        [("::TestMethods::basicWithSimpleArgs::arg1", "arg1", "Boolean", False, False),
-         ("::TestMethods::basicWithSimpleArgs::arg2", "arg2", "Byte", False, False),
-         ("::TestMethods::basicWithSimpleArgs::arg3", "arg3", "UnsignedLong", False, False)])])
+                [("Void",
+                  [("::TestMethods::basicWithSimpleArgs::arg1", "arg1", "Boolean",
+                    False, False),
+                   ("::TestMethods::basicWithSimpleArgs::arg2", "arg2", "Byte",
+                    False, False),
+                   ("::TestMethods::basicWithSimpleArgs::arg3", "arg3", "UnsignedLong",
+                    False, False)])])
     checkMethod(methods[3], "::TestMethods::basicBoolean", "basicBoolean", [("Boolean", [])])
-    checkMethod(methods[4], "::TestMethods::basicStaticBoolean", "basicStaticBoolean", [("Boolean", [])], static=True)
+    checkMethod(methods[4], "::TestMethods::basicStaticBoolean",
+                "basicStaticBoolean", [("Boolean", [])], static=True)
     checkMethod(methods[5], "::TestMethods::basicBooleanWithSimpleArgs",
                 "basicBooleanWithSimpleArgs",
-       [("Boolean",
-        [("::TestMethods::basicBooleanWithSimpleArgs::arg1", "arg1", "Boolean", False, False),
-         ("::TestMethods::basicBooleanWithSimpleArgs::arg2", "arg2", "Byte", False, False),
-         ("::TestMethods::basicBooleanWithSimpleArgs::arg3", "arg3", "UnsignedLong", False, False)])])
+                [("Boolean",
+                  [("::TestMethods::basicBooleanWithSimpleArgs::arg1", "arg1", "Boolean",
+                    False, False),
+                   ("::TestMethods::basicBooleanWithSimpleArgs::arg2", "arg2", "Byte",
+                    False, False),
+                   ("::TestMethods::basicBooleanWithSimpleArgs::arg3", "arg3", "UnsignedLong",
+                    False, False)])])
     checkMethod(methods[6], "::TestMethods::optionalArg",
                 "optionalArg",
-       [("Void",
-        [("::TestMethods::optionalArg::arg1", "arg1", "ByteOrNull", True, False),
-         ("::TestMethods::optionalArg::arg2", "arg2", "ByteSequence", True, False)])])
+                [("Void",
+                  [("::TestMethods::optionalArg::arg1", "arg1", "ByteOrNull", True, False),
+                   ("::TestMethods::optionalArg::arg2", "arg2", "ByteSequence", True, False)])])
     checkMethod(methods[7], "::TestMethods::variadicArg",
                 "variadicArg",
-       [("Void",
-        [("::TestMethods::variadicArg::arg1", "arg1", "ByteOrNull", True, True)])])
+                [("Void",
+                  [("::TestMethods::variadicArg::arg1", "arg1", "ByteOrNull", True, True)])])
     checkMethod(methods[8], "::TestMethods::getObject",
                 "getObject", [("Object", [])])
     checkMethod(methods[9], "::TestMethods::setObject",
                 "setObject",
-       [("Void",
-        [("::TestMethods::setObject::arg1", "arg1", "Object", False, False)])])
+                [("Void",
+                  [("::TestMethods::setObject::arg1", "arg1", "Object", False, False)])])
     checkMethod(methods[10], "::TestMethods::setAny",
                 "setAny",
-       [("Void",
-        [("::TestMethods::setAny::arg1", "arg1", "Any", False, False)])])
+                [("Void",
+                  [("::TestMethods::setAny::arg1", "arg1", "Any", False, False)])])
     checkMethod(methods[11], "::TestMethods::doFloats",
                 "doFloats",
-       [("Float",
-        [("::TestMethods::doFloats::arg1", "arg1", "Float", False, False)])])
+                [("Float",
+                  [("::TestMethods::doFloats::arg1", "arg1", "Float", False, False)])])
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
           interface A {
             void foo(optional float bar = 1);
           };
         """)
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(not threw, "Should allow integer to float type corecion")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
           interface A {
             [GetterThrows] void foo();
           };
         """)
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should not allow [GetterThrows] on methods")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
           interface A {
             [SetterThrows] void foo();
           };
         """)
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should not allow [SetterThrows] on methods")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
           interface A {
             [Throw] void foo();
           };
         """)
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should spell [Throws] correctly on methods")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
           interface A {
             void __noSuchMethod__();
           };
         """)
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should not allow __noSuchMethod__ methods")
--- a/dom/bindings/parser/tests/test_namespace.py
+++ b/dom/bindings/parser/tests/test_namespace.py
@@ -4,17 +4,17 @@ def WebIDLTest(parser, harness):
         namespace MyNamespace {
           attribute any foo;
           any bar();
         };
         """)
 
     results = parser.finish()
     harness.check(len(results), 1, "Should have a thing.")
-    harness.ok(results[0].isNamespace(), "Our thing should be a namespace");
+    harness.ok(results[0].isNamespace(), "Our thing should be a namespace")
     harness.check(len(results[0].members), 2,
                   "Should have two things in our namespace")
     harness.ok(results[0].members[0].isAttr(), "First member is attribute")
     harness.ok(results[0].members[0].isStatic(), "Attribute should be static")
     harness.ok(results[0].members[1].isMethod(), "Second member is method")
     harness.ok(results[0].members[1].isStatic(), "Operation should be static")
 
     parser = parser.reset()
@@ -25,72 +25,72 @@ def WebIDLTest(parser, harness):
         };
         partial namespace MyNamespace {
           any bar();
         };
         """)
 
     results = parser.finish()
     harness.check(len(results), 2, "Should have things.")
-    harness.ok(results[0].isNamespace(), "Our thing should be a namespace");
+    harness.ok(results[0].isNamespace(), "Our thing should be a namespace")
     harness.check(len(results[0].members), 2,
                   "Should have two things in our namespace")
     harness.ok(results[0].members[0].isAttr(), "First member is attribute")
-    harness.ok(results[0].members[0].isStatic(), "Attribute should be static");
+    harness.ok(results[0].members[0].isStatic(), "Attribute should be static")
     harness.ok(results[0].members[1].isMethod(), "Second member is method")
-    harness.ok(results[0].members[1].isStatic(), "Operation should be static");
+    harness.ok(results[0].members[1].isStatic(), "Operation should be static")
 
     parser = parser.reset()
     parser.parse(
         """
         partial namespace MyNamespace {
           any bar();
         };
         namespace MyNamespace {
           attribute any foo;
         };
         """)
 
     results = parser.finish()
     harness.check(len(results), 2, "Should have things.")
-    harness.ok(results[1].isNamespace(), "Our thing should be a namespace");
+    harness.ok(results[1].isNamespace(), "Our thing should be a namespace")
     harness.check(len(results[1].members), 2,
                   "Should have two things in our namespace")
     harness.ok(results[1].members[0].isAttr(), "First member is attribute")
-    harness.ok(results[1].members[0].isStatic(), "Attribute should be static");
+    harness.ok(results[1].members[0].isStatic(), "Attribute should be static")
     harness.ok(results[1].members[1].isMethod(), "Second member is method")
-    harness.ok(results[1].members[1].isStatic(), "Operation should be static");
+    harness.ok(results[1].members[1].isStatic(), "Operation should be static")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
             namespace MyNamespace {
               static attribute any foo;
             };
         """)
 
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should have thrown.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
             namespace MyNamespace {
               static any bar();
             };
         """)
 
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should have thrown.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
@@ -99,17 +99,17 @@ def WebIDLTest(parser, harness):
             };
 
             interface MyNamespace {
               any baz();
             };
         """)
 
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should have thrown.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
@@ -118,17 +118,17 @@ def WebIDLTest(parser, harness):
             };
 
             namespace MyNamespace {
               any bar();
             };
         """)
 
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should have thrown.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
@@ -137,17 +137,17 @@ def WebIDLTest(parser, harness):
             };
 
             namespace MyNamespace {
               any bar();
             };
         """)
 
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should have thrown.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
@@ -156,17 +156,17 @@ def WebIDLTest(parser, harness):
             };
 
             interface MyNamespace {
               any bar();
             };
         """)
 
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should have thrown.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
@@ -175,17 +175,17 @@ def WebIDLTest(parser, harness):
             };
 
             partial interface MyNamespace {
               any baz();
             };
         """)
 
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should have thrown.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
@@ -194,17 +194,17 @@ def WebIDLTest(parser, harness):
             };
 
             namespace MyNamespace {
               any bar();
             };
         """)
 
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should have thrown.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
@@ -213,11 +213,11 @@ def WebIDLTest(parser, harness):
             };
 
             partial namespace MyNamespace {
               any baz();
             };
         """)
 
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should have thrown.")
--- a/dom/bindings/parser/tests/test_newobject.py
+++ b/dom/bindings/parser/tests/test_newobject.py
@@ -1,11 +1,9 @@
 # Import the WebIDL module, so we can do isinstance checks and whatnot
-import WebIDL
-
 def WebIDLTest(parser, harness):
     # Basic functionality
     parser.parse(
         """
         interface Iface {
           [NewObject] readonly attribute Iface attr;
           [NewObject] Iface method();
         };
@@ -18,53 +16,53 @@ def WebIDLTest(parser, harness):
     try:
         parser.parse(
             """
             interface Iface {
               [Pure, NewObject] readonly attribute Iface attr;
             };
             """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw, "[NewObject] attributes must depend on something")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
             interface Iface {
               [Pure, NewObject] Iface method();
             };
             """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw, "[NewObject] methods must depend on something")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
             interface Iface {
               [Cached, NewObject, Affects=Nothing] readonly attribute Iface attr;
             };
             """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw, "[NewObject] attributes must not be [Cached]")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
             interface Iface {
               [StoreInSlot, NewObject, Affects=Nothing] readonly attribute Iface attr;
             };
             """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw, "[NewObject] attributes must not be [StoreInSlot]")
--- a/dom/bindings/parser/tests/test_nullable_equivalency.py
+++ b/dom/bindings/parser/tests/test_nullable_equivalency.py
@@ -1,10 +1,8 @@
-import WebIDL
-
 def WebIDLTest(parser, harness):
     parser.parse("""
         interface TestNullableEquivalency1 {
           attribute long  a;
           attribute long? b;
         };
 
         interface TestNullableEquivalency2 {
@@ -54,16 +52,17 @@ def WebIDLTest(parser, harness):
           attribute object? b;
         };
     """)
 
     for decl in parser.finish():
         if decl.isInterface():
             checkEquivalent(decl, harness)
 
+
 def checkEquivalent(iface, harness):
     type1 = iface.members[0].type
     type2 = iface.members[1].type
 
     harness.check(type1.nullable(), False, 'attr1 should not be nullable')
     harness.check(type2.nullable(), True, 'attr2 should be nullable')
 
     # We don't know about type1, but type2, the nullable type, definitely
@@ -84,32 +83,33 @@ def checkEquivalent(iface, harness):
            (hasattr(type(type1), attr) and not callable(getattr(type1, attr))):
             continue
 
         a1 = getattr(type1, attr)
 
         if callable(a1):
             try:
                 v1 = a1()
-            except:
+            except Exception:
                 # Can't call a1 with no args, so skip this attriute.
                 continue
 
             try:
                 a2 = getattr(type2, attr)
-            except:
+            except Exception:
                 harness.ok(False, 'Missing %s attribute on type %s in %s' % (attr, type2, iface))
                 continue
 
             if not callable(a2):
-                harness.ok(False, "%s attribute on type %s in %s wasn't callable" % (attr, type2, iface))
+                harness.ok(False, "%s attribute on type %s in %s wasn't callable" %
+                           (attr, type2, iface))
                 continue
 
             v2 = a2()
             harness.check(v2, v1, '%s method return value' % attr)
         else:
             try:
                 a2 = getattr(type2, attr)
-            except:
+            except Exception:
                 harness.ok(False, 'Missing %s attribute on type %s in %s' % (attr, type2, iface))
                 continue
 
             harness.check(a2, a1, '%s attribute should match' % attr)
--- a/dom/bindings/parser/tests/test_nullable_void.py
+++ b/dom/bindings/parser/tests/test_nullable_void.py
@@ -2,13 +2,13 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface NullableVoid {
               void? foo();
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
--- a/dom/bindings/parser/tests/test_optional_constraints.py
+++ b/dom/bindings/parser/tests/test_optional_constraints.py
@@ -3,17 +3,17 @@ def WebIDLTest(parser, harness):
     try:
         parser.parse("""
             interface OptionalConstraints1 {
               void foo(optional byte arg1, byte arg2);
             };
         """)
 
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(not threw,
                "Should not have thrown on non-optional argument following "
                "optional argument.")
 
     parser = parser.reset()
     parser.parse("""
--- a/dom/bindings/parser/tests/test_overload.py
+++ b/dom/bindings/parser/tests/test_overload.py
@@ -1,10 +1,11 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     parser.parse("""
         interface TestOverloads {
           void basic();
           void basic(long arg1);
           boolean abitharder(TestOverloads foo);
           boolean abitharder(boolean foo);
           void abitharder(ArrayBuffer? foo);
@@ -23,17 +24,18 @@ def WebIDLTest(parser, harness):
     iface = results[0]
     harness.ok(isinstance(iface, WebIDL.IDLInterface),
                "Should be an IDLInterface")
     harness.check(iface.identifier.QName(), "::TestOverloads", "Interface has the right QName")
     harness.check(iface.identifier.name, "TestOverloads", "Interface has the right name")
     harness.check(len(iface.members), 4, "Expect %s members" % 4)
 
     member = iface.members[0]
-    harness.check(member.identifier.QName(), "::TestOverloads::basic", "Method has the right QName")
+    harness.check(member.identifier.QName(), "::TestOverloads::basic",
+                  "Method has the right QName")
     harness.check(member.identifier.name, "basic", "Method has the right name")
     harness.check(member.hasOverloads(), True, "Method has overloads")
 
     signatures = member.signatures()
     harness.check(len(signatures), 2, "Method should have 2 signatures")
 
     (retval, argumentSet) = signatures[0]
 
@@ -42,17 +44,18 @@ def WebIDLTest(parser, harness):
 
     (retval, argumentSet) = signatures[1]
     harness.check(str(retval), "Void", "Expect a void retval")
     harness.check(len(argumentSet), 1, "Expect an argument set with one argument")
 
     argument = argumentSet[0]
     harness.ok(isinstance(argument, WebIDL.IDLArgument),
                "Should be an IDLArgument")
-    harness.check(argument.identifier.QName(), "::TestOverloads::basic::arg1", "Argument has the right QName")
+    harness.check(argument.identifier.QName(), "::TestOverloads::basic::arg1",
+                  "Argument has the right QName")
     harness.check(argument.identifier.name, "arg1", "Argument has the right name")
     harness.check(str(argument.type), "Long", "Argument has the right type")
 
     member = iface.members[3]
     harness.check(len(member.overloadsForArgCount(0)), 1,
                   "Only one overload for no args")
     harness.check(len(member.overloadsForArgCount(1)), 0,
                   "No overloads for one arg")
--- a/dom/bindings/parser/tests/test_promise.py
+++ b/dom/bindings/parser/tests/test_promise.py
@@ -1,157 +1,157 @@
 def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface A {
               legacycaller Promise<any> foo();
             };
         """)
-        results = parser.finish()
+        parser.finish()
 
-    except:
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should not allow Promise return values for legacycaller.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A {
               Promise<any> foo();
               long foo(long arg);
             };
         """)
-        results = parser.finish();
-    except:
+        parser.finish()
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should not allow overloads which have both Promise and "
                "non-Promise return types.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A {
               long foo(long arg);
               Promise<any> foo();
             };
         """)
-        results = parser.finish();
-    except:
+        parser.finish()
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should not allow overloads which have both Promise and "
                "non-Promise return types.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A {
               Promise<any>? foo();
             };
         """)
-        results = parser.finish();
-    except:
+        parser.finish()
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should not allow nullable Promise return values.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A {
               void foo(Promise<any>? arg);
             };
         """)
-        results = parser.finish();
-    except:
+        parser.finish()
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should not allow nullable Promise arguments.")
 
     parser = parser.reset()
     parser.parse("""
         interface A {
           Promise<any> foo();
           Promise<any> foo(long arg);
         };
     """)
-    results = parser.finish();
+    parser.finish()
 
     harness.ok(True,
                "Should allow overloads which only have Promise and return "
                "types.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A {
               attribute Promise<any> attr;
             };
         """)
-        results = parser.finish();
-    except:
+        parser.finish()
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should not allow writable Promise-typed attributes.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A {
               [LenientSetter] readonly attribute Promise<any> attr;
             };
         """)
-        results = parser.finish();
-    except:
+        parser.finish()
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should not allow [LenientSetter] Promise-typed attributes.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A {
               [PutForwards=bar] readonly attribute Promise<any> attr;
             };
         """)
-        results = parser.finish();
-    except:
+        parser.finish()
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should not allow [PutForwards] Promise-typed attributes.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A {
               [Replaceable] readonly attribute Promise<any> attr;
             };
         """)
-        results = parser.finish();
-    except:
+        parser.finish()
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should not allow [Replaceable] Promise-typed attributes.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface A {
               [SameObject] readonly attribute Promise<any> attr;
             };
         """)
-        results = parser.finish();
-    except:
+        parser.finish()
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should not allow [SameObject] Promise-typed attributes.")
--- a/dom/bindings/parser/tests/test_prototype_ident.py
+++ b/dom/bindings/parser/tests/test_prototype_ident.py
@@ -2,79 +2,81 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface TestIface {
               static attribute boolean prototype;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "The identifier of a static attribute must not be 'prototype'")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface TestIface {
               static boolean prototype();
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "The identifier of a static operation must not be 'prototype'")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface TestIface {
               const boolean prototype = true;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "The identifier of a constant must not be 'prototype'")
 
     # Make sure that we can parse non-static attributes with 'prototype' as identifier.
     parser = parser.reset()
     parser.parse("""
         interface TestIface {
           attribute boolean prototype;
         };
     """)
     results = parser.finish()
 
-    testIface = results[0];
+    testIface = results[0]
     harness.check(testIface.members[0].isStatic(), False, "Attribute should not be static")
-    harness.check(testIface.members[0].identifier.name, "prototype", "Attribute identifier should be 'prototype'")
+    harness.check(testIface.members[0].identifier.name, "prototype",
+                  "Attribute identifier should be 'prototype'")
 
     # Make sure that we can parse non-static operations with 'prototype' as identifier.
     parser = parser.reset()
     parser.parse("""
         interface TestIface {
           boolean prototype();
         };
     """)
     results = parser.finish()
 
-    testIface = results[0];
+    testIface = results[0]
     harness.check(testIface.members[0].isStatic(), False, "Operation should not be static")
-    harness.check(testIface.members[0].identifier.name, "prototype", "Operation identifier should be 'prototype'")
+    harness.check(testIface.members[0].identifier.name, "prototype",
+                  "Operation identifier should be 'prototype'")
 
     # Make sure that we can parse dictionary members with 'prototype' as identifier.
     parser = parser.reset()
     parser.parse("""
         dictionary TestDict {
           boolean prototype;
         };
     """)
     results = parser.finish()
 
-    testDict = results[0];
-    harness.check(testDict.members[0].identifier.name, "prototype", "Dictionary member should be 'prototype'")
-
+    testDict = results[0]
+    harness.check(testDict.members[0].identifier.name, "prototype",
+                  "Dictionary member should be 'prototype'")
--- a/dom/bindings/parser/tests/test_putForwards.py
+++ b/dom/bindings/parser/tests/test_putForwards.py
@@ -2,106 +2,106 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface I {
               [PutForwards=B] readonly attribute long A;
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface I {
               [PutForwards=B] readonly attribute J A;
             };
             interface J {
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface I {
               [PutForwards=B] attribute J A;
             };
             interface J {
               attribute long B;
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface I {
               [PutForwards=B] static readonly attribute J A;
             };
             interface J {
               attribute long B;
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             callback interface I {
               [PutForwards=B] readonly attribute J A;
             };
             interface J {
               attribute long B;
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface I {
               [PutForwards=C] readonly attribute J A;
               [PutForwards=C] readonly attribute J B;
             };
             interface J {
               [PutForwards=D] readonly attribute K C;
             };
             interface K {
               [PutForwards=A] readonly attribute I D;
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
--- a/dom/bindings/parser/tests/test_record.py
+++ b/dom/bindings/parser/tests/test_record.py
@@ -1,23 +1,24 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     parser.parse("""
         dictionary Dict {};
         interface RecordArg {
           void foo(record<DOMString, Dict> arg);
         };
     """)
 
     results = parser.finish()
 
-    harness.check(len(results), 2, "Should know about two things");
+    harness.check(len(results), 2, "Should know about two things")
     harness.ok(isinstance(results[1], WebIDL.IDLInterface),
-               "Should have an interface here");
+               "Should have an interface here")
     members = results[1].members
     harness.check(len(members), 1, "Should have one member")
     harness.ok(members[0].isMethod(), "Should have method")
     signature = members[0].signatures()[0]
     args = signature[1]
     harness.check(len(args), 1, "Should have one arg")
     harness.ok(args[0].type.isRecord(), "Should have a record type here")
     harness.ok(args[0].type.inner.isDictionary(),
@@ -28,26 +29,26 @@ def WebIDLTest(parser, harness):
     try:
         parser.parse("""
             interface RecordVoidArg {
               void foo(record<DOMString, void> arg);
             };
         """)
 
         results = parser.finish()
-    except Exception,x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should have thrown because record can't have void as value type.")
- 
+
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             dictionary Dict {
               record<DOMString, Dict> val;
             };
         """)
 
         results = parser.finish()
-    except Exception,x:
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should have thrown on dictionary containing itself via record.")
--- a/dom/bindings/parser/tests/test_replaceable.py
+++ b/dom/bindings/parser/tests/test_replaceable.py
@@ -1,19 +1,20 @@
 # 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/.
 
+
 def should_throw(parser, harness, message, code):
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse(code)
         parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown: %s" % message)
 
 
 def WebIDLTest(parser, harness):
     # The [Replaceable] extended attribute MUST take no arguments.
     should_throw(parser, harness, "no arguments", """
--- a/dom/bindings/parser/tests/test_securecontext_extended_attribute.py
+++ b/dom/bindings/parser/tests/test_securecontext_extended_attribute.py
@@ -1,40 +1,39 @@
-import WebIDL
-
 def WebIDLTest(parser, harness):
     parser.parse("""
         [SecureContext]
         interface TestSecureContextOnInterface {
           const octet TEST_CONSTANT = 0;
           readonly attribute byte testAttribute;
           void testMethod(byte foo);
         };
         partial interface TestSecureContextOnInterface {
           const octet TEST_CONSTANT_2 = 0;
           readonly attribute byte testAttribute2;
           void testMethod2(byte foo);
         };
     """)
     results = parser.finish()
-    harness.check(len(results[0].members), 6, "TestSecureContextOnInterface should have six members")
+    harness.check(len(results[0].members), 6,
+                  "TestSecureContextOnInterface should have six members")
     harness.ok(results[0].getExtendedAttribute("SecureContext"),
                "Interface should have [SecureContext] extended attribute")
     harness.ok(results[0].members[0].getExtendedAttribute("SecureContext"),
                "[SecureContext] should propagate from interface to constant members")
     harness.ok(results[0].members[1].getExtendedAttribute("SecureContext"),
                "[SecureContext] should propagate from interface to attribute members")
     harness.ok(results[0].members[2].getExtendedAttribute("SecureContext"),
                "[SecureContext] should propagate from interface to method members")
     harness.ok(results[0].members[3].getExtendedAttribute("SecureContext"),
-               "[SecureContext] should propagate from interface to constant members from partial interface")
+               "[SecureContext] should propagate from interface to constant members from partial interface")  # NOQA: E501
     harness.ok(results[0].members[4].getExtendedAttribute("SecureContext"),
-               "[SecureContext] should propagate from interface to attribute members from partial interface")
+               "[SecureContext] should propagate from interface to attribute members from partial interface")  # NOQA: E501
     harness.ok(results[0].members[5].getExtendedAttribute("SecureContext"),
-               "[SecureContext] should propagate from interface to method members from partial interface")
+               "[SecureContext] should propagate from interface to method members from partial interface")  # NOQA: E501
 
     # Same thing, but with the partial interface specified first:
     parser = parser.reset()
     parser.parse("""
         partial interface TestSecureContextOnInterfaceAfterPartialInterface {
           const octet TEST_CONSTANT_2 = 0;
           readonly attribute byte testAttribute2;
           void testMethod2(byte foo);
@@ -42,60 +41,62 @@ def WebIDLTest(parser, harness):
         [SecureContext]
         interface TestSecureContextOnInterfaceAfterPartialInterface {
           const octet TEST_CONSTANT = 0;
           readonly attribute byte testAttribute;
           void testMethod(byte foo);
         };
      """)
     results = parser.finish()
-    harness.check(len(results[1].members), 6, "TestSecureContextOnInterfaceAfterPartialInterface should have six members")
+    harness.check(len(results[1].members), 6,
+                  "TestSecureContextOnInterfaceAfterPartialInterface should have six members")
     harness.ok(results[1].getExtendedAttribute("SecureContext"),
                "Interface should have [SecureContext] extended attribute")
     harness.ok(results[1].members[0].getExtendedAttribute("SecureContext"),
                "[SecureContext] should propagate from interface to constant members")
     harness.ok(results[1].members[1].getExtendedAttribute("SecureContext"),
                "[SecureContext] should propagate from interface to attribute members")
     harness.ok(results[1].members[2].getExtendedAttribute("SecureContext"),
                "[SecureContext] should propagate from interface to method members")
     harness.ok(results[1].members[3].getExtendedAttribute("SecureContext"),
-               "[SecureContext] should propagate from interface to constant members from partial interface")
+               "[SecureContext] should propagate from interface to constant members from partial interface")  # NOQA: E501
     harness.ok(results[1].members[4].getExtendedAttribute("SecureContext"),
-               "[SecureContext] should propagate from interface to attribute members from partial interface")
+               "[SecureContext] should propagate from interface to attribute members from partial interface")  # NOQA: E501
     harness.ok(results[1].members[5].getExtendedAttribute("SecureContext"),
-               "[SecureContext] should propagate from interface to method members from partial interface")
+               "[SecureContext] should propagate from interface to method members from partial interface")  # NOQA: E501
 
     parser = parser.reset()
     parser.parse("""
         interface TestSecureContextOnPartialInterface {
           const octet TEST_CONSTANT = 0;
           readonly attribute byte testAttribute;
           void testMethod(byte foo);
         };
         [SecureContext]
         partial interface TestSecureContextOnPartialInterface {
           const octet TEST_CONSTANT_2 = 0;
           readonly attribute byte testAttribute2;
           void testMethod2(byte foo);
         };
     """)
     results = parser.finish()
-    harness.check(len(results[0].members), 6, "TestSecureContextOnPartialInterface should have six members")
+    harness.check(len(results[0].members), 6,
+                  "TestSecureContextOnPartialInterface should have six members")
     harness.ok(results[0].getExtendedAttribute("SecureContext") is None,
                "[SecureContext] should not propagate from a partial interface to the interface")
     harness.ok(results[0].members[0].getExtendedAttribute("SecureContext") is None,
-               "[SecureContext] should not propagate from a partial interface to the interface's constant members")
+               "[SecureContext] should not propagate from a partial interface to the interface's constant members")  # NOQA: E501
     harness.ok(results[0].members[1].getExtendedAttribute("SecureContext") is None,
-               "[SecureContext] should not propagate from a partial interface to the interface's attribute members")
+               "[SecureContext] should not propagate from a partial interface to the interface's attribute members")  # NOQA: E501
     harness.ok(results[0].members[2].getExtendedAttribute("SecureContext") is None,
-               "[SecureContext] should not propagate from a partial interface to the interface's method members")
+               "[SecureContext] should not propagate from a partial interface to the interface's method members")  # NOQA: E501
     harness.ok(results[0].members[3].getExtendedAttribute("SecureContext"),
                "Constant members from [SecureContext] partial interface should be [SecureContext]")
     harness.ok(results[0].members[4].getExtendedAttribute("SecureContext"),
-               "Attribute members from [SecureContext] partial interface should be [SecureContext]")
+               "Attribute members from [SecureContext] partial interface should be [SecureContext]")  # NOQA: E501
     harness.ok(results[0].members[5].getExtendedAttribute("SecureContext"),
                "Method members from [SecureContext] partial interface should be [SecureContext]")
 
     parser = parser.reset()
     parser.parse("""
         interface TestSecureContextOnInterfaceMembers {
           const octet TEST_NON_SECURE_CONSTANT_1 = 0;
           [SecureContext]
@@ -107,17 +108,18 @@ def WebIDLTest(parser, harness):
           readonly attribute byte testNonSecureAttribute2;
           void testNonSecureMethod1(byte foo);
           [SecureContext]
           void testSecureMethod(byte foo);
           void testNonSecureMethod2(byte foo);
         };
     """)
     results = parser.finish()
-    harness.check(len(results[0].members), 9, "TestSecureContextOnInterfaceMembers should have nine members")
+    harness.check(len(results[0].members), 9,
+                  "TestSecureContextOnInterfaceMembers should have nine members")
     harness.ok(results[0].getExtendedAttribute("SecureContext") is None,
                "[SecureContext] on members should not propagate up to the interface")
     harness.ok(results[0].members[0].getExtendedAttribute("SecureContext") is None,
                "Constant should not have [SecureContext] extended attribute")
     harness.ok(results[0].members[1].getExtendedAttribute("SecureContext"),
                "Constant should have [SecureContext] extended attribute")
     harness.ok(results[0].members[2].getExtendedAttribute("SecureContext") is None,
                "Constant should not have [SecureContext] extended attribute")
@@ -149,29 +151,30 @@ def WebIDLTest(parser, harness):
           readonly attribute byte testNonSecureAttribute2;
           void testNonSecureMethod1(byte foo);
           [SecureContext]
           void testSecureMethod(byte foo);
           void testNonSecureMethod2(byte foo);
         };
     """)
     results = parser.finish()
-    harness.check(len(results[0].members), 9, "TestSecureContextOnPartialInterfaceMembers should have nine members")
+    harness.check(len(results[0].members), 9,
+                  "TestSecureContextOnPartialInterfaceMembers should have nine members")
     harness.ok(results[0].members[0].getExtendedAttribute("SecureContext") is None,
-               "Constant from partial interface should not have [SecureContext] extended attribute")
+               "Constant from partial interface should not have [SecureContext] extended attribute")  # NOQA: E501
     harness.ok(results[0].members[1].getExtendedAttribute("SecureContext"),
                "Constant from partial interface should have [SecureContext] extended attribute")
     harness.ok(results[0].members[2].getExtendedAttribute("SecureContext") is None,
-               "Constant from partial interface should not have [SecureContext] extended attribute")
+               "Constant from partial interface should not have [SecureContext] extended attribute")  # NOQA: E501
     harness.ok(results[0].members[3].getExtendedAttribute("SecureContext") is None,
-               "Attribute from partial interface should not have [SecureContext] extended attribute")
+               "Attribute from partial interface should not have [SecureContext] extended attribute")  # NOQA: E501
     harness.ok(results[0].members[4].getExtendedAttribute("SecureContext"),
                "Attribute from partial interface should have [SecureContext] extended attribute")
     harness.ok(results[0].members[5].getExtendedAttribute("SecureContext") is None,
-               "Attribute from partial interface should not have [SecureContext] extended attribute")
+               "Attribute from partial interface should not have [SecureContext] extended attribute")  # NOQA: E501
     harness.ok(results[0].members[6].getExtendedAttribute("SecureContext") is None,
                "Method from partial interface should not have [SecureContext] extended attribute")
     harness.ok(results[0].members[7].getExtendedAttribute("SecureContext"),
                "Method from partial interface should have [SecureContext] extended attribute")
     harness.ok(results[0].members[8].getExtendedAttribute("SecureContext") is None,
                "Method from partial interface should not have [SecureContext] extended attribute")
 
     parser = parser.reset()
@@ -179,154 +182,161 @@ def WebIDLTest(parser, harness):
     try:
         parser.parse("""
             [SecureContext=something]
             interface TestSecureContextTakesNoValue1 {
               const octet TEST_SECURE_CONSTANT = 0;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw, "[SecureContext] must take no arguments (testing on interface)")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface TestSecureContextForOverloads1 {
               [SecureContext]
               void testSecureMethod(byte foo);
             };
             partial interface TestSecureContextForOverloads1 {
               void testSecureMethod(byte foo, byte bar);
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
-    harness.ok(threw, "If [SecureContext] appears on an overloaded operation, then it MUST appear on all overloads")
+    harness.ok(
+        threw, "If [SecureContext] appears on an overloaded operation, then it MUST appear on all overloads")  # NOQA: E501
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface TestSecureContextForOverloads2 {
               [SecureContext]
               void testSecureMethod(byte foo);
             };
             partial interface TestSecureContextForOverloads2 {
               [SecureContext]
               void testSecureMethod(byte foo, byte bar);
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
-    harness.ok(not threw, "[SecureContext] can appear on an overloaded operation if it appears on all overloads")
+    harness.ok(
+        not threw, "[SecureContext] can appear on an overloaded operation if it appears on all overloads")  # NOQA: E501
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [SecureContext]
             interface TestSecureContextOnInterfaceAndMember {
               [SecureContext]
               void testSecureMethod(byte foo);
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw, "[SecureContext] must not appear on an interface and interface member")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface TestSecureContextOnPartialInterfaceAndMember {
             };
             [SecureContext]
             partial interface TestSecureContextOnPartialInterfaceAndMember {
               [SecureContext]
               void testSecureMethod(byte foo);
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
-    harness.ok(threw, "[SecureContext] must not appear on a partial interface and one of the partial interface's member's")
+    harness.ok(
+        threw, "[SecureContext] must not appear on a partial interface and one of the partial interface's member's")  # NOQA: E501
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [SecureContext]
             interface TestSecureContextOnInterfaceAndPartialInterfaceMember {
             };
             partial interface TestSecureContextOnInterfaceAndPartialInterfaceMember {
               [SecureContext]
               void testSecureMethod(byte foo);
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
-    harness.ok(threw, "[SecureContext] must not appear on an interface and one of its partial interface's member's")
+    harness.ok(
+        threw, "[SecureContext] must not appear on an interface and one of its partial interface's member's")  # NOQA: E501
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [SecureContext]
             interface TestSecureContextOnInheritedInterface {
             };
             interface TestSecureContextNotOnInheritingInterface : TestSecureContextOnInheritedInterface {
               void testSecureMethod(byte foo);
             };
-        """)
+        """)  # NOQA: E501
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
-    harness.ok(threw, "[SecureContext] must appear on interfaces that inherit from another [SecureContext] interface")
+    harness.ok(
+        threw, "[SecureContext] must appear on interfaces that inherit from another [SecureContext] interface")  # NOQA: E501
 
     # Test 'implements'. The behavior tested here may have to change depending
     # on the resolution of https://github.com/heycam/webidl/issues/118
     parser = parser.reset()
     parser.parse("""
         [SecureContext]
         interface TestSecureContextInterfaceThatImplementsNonSecureContextInterface {
           const octet TEST_CONSTANT = 0;
         };
         interface TestNonSecureContextInterface {
           const octet TEST_CONSTANT_2 = 0;
           readonly attribute byte testAttribute2;
           void testMethod2(byte foo);
         };
         TestSecureContextInterfaceThatImplementsNonSecureContextInterface implements TestNonSecureContextInterface;
-     """)
+     """)  # NOQA: E501
     results = parser.finish()
-    harness.check(len(results[0].members), 4, "TestSecureContextInterfaceThatImplementsNonSecureContextInterface should have two members")
+    harness.check(len(results[0].members), 4,
+                  "TestSecureContextInterfaceThatImplementsNonSecureContextInterface should have two members")  # NOQA: E501
     harness.ok(results[0].getExtendedAttribute("SecureContext"),
                "Interface should have [SecureContext] extended attribute")
     harness.ok(results[0].members[0].getExtendedAttribute("SecureContext"),
-               "[SecureContext] should propagate from interface to constant members even when other members are copied from a non-[SecureContext] interface")
+               "[SecureContext] should propagate from interface to constant members even when other members are copied from a non-[SecureContext] interface")  # NOQA: E501
     harness.ok(results[0].members[1].getExtendedAttribute("SecureContext") is None,
                "Constants copied from non-[SecureContext] interface should not be [SecureContext]")
     harness.ok(results[0].members[2].getExtendedAttribute("SecureContext") is None,
-               "Attributes copied from non-[SecureContext] interface should not be [SecureContext]")
+               "Attributes copied from non-[SecureContext] interface should not be [SecureContext]")  # NOQA: E501
     harness.ok(results[0].members[3].getExtendedAttribute("SecureContext") is None,
                "Methods copied from non-[SecureContext] interface should not be [SecureContext]")
- 
+
     # Test SecureContext and NoInterfaceObject
     parser = parser.reset()
     parser.parse("""
         [NoInterfaceObject, SecureContext]
         interface TestSecureContextNoInterfaceObject {
           void testSecureMethod(byte foo);
         };
     """)
     results = parser.finish()
-    harness.check(len(results[0].members), 1, "TestSecureContextNoInterfaceObject should have only one member")
+    harness.check(len(results[0].members), 1,
+                  "TestSecureContextNoInterfaceObject should have only one member")
     harness.ok(results[0].getExtendedAttribute("SecureContext"),
-      "Interface should have [SecureContext] extended attribute")
+               "Interface should have [SecureContext] extended attribute")
     harness.ok(results[0].members[0].getExtendedAttribute("SecureContext"),
-      "Interface member should have [SecureContext] extended attribute")
+               "Interface member should have [SecureContext] extended attribute")
--- a/dom/bindings/parser/tests/test_special_method_signature_mismatch.py
+++ b/dom/bindings/parser/tests/test_special_method_signature_mismatch.py
@@ -2,223 +2,223 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodSignatureMismatch1 {
               getter long long foo(long index);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodSignatureMismatch2 {
               getter void foo(unsigned long index);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodSignatureMismatch3 {
               getter boolean foo(unsigned long index, boolean extraArg);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodSignatureMismatch4 {
               getter boolean foo(unsigned long... index);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodSignatureMismatch5 {
               getter boolean foo(optional unsigned long index);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodSignatureMismatch6 {
               getter boolean foo();
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodSignatureMismatch7 {
               deleter long long foo(long index);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodSignatureMismatch9 {
               deleter boolean foo(unsigned long index, boolean extraArg);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodSignatureMismatch10 {
               deleter boolean foo(unsigned long... index);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodSignatureMismatch11 {
               deleter boolean foo(optional unsigned long index);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodSignatureMismatch12 {
               deleter boolean foo();
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodSignatureMismatch13 {
               setter long long foo(long index, long long value);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodSignatureMismatch15 {
               setter boolean foo(unsigned long index, boolean value, long long extraArg);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodSignatureMismatch16 {
               setter boolean foo(unsigned long index, boolean... value);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodSignatureMismatch17 {
               setter boolean foo(unsigned long index, optional boolean value);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodSignatureMismatch18 {
               setter boolean foo();
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
--- a/dom/bindings/parser/tests/test_special_methods.py
+++ b/dom/bindings/parser/tests/test_special_methods.py
@@ -1,10 +1,11 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     parser.parse("""
         interface SpecialMethods {
           getter long long (unsigned long index);
           setter long long (unsigned long index, long long value);
           getter boolean (DOMString name);
           setter boolean (DOMString name, boolean value);
           deleter boolean (DOMString name);
@@ -24,18 +25,20 @@ def WebIDLTest(parser, harness):
         harness.ok(isinstance(method, WebIDL.IDLMethod),
                    "Should be an IDLMethod")
         harness.check(method.identifier.QName(), QName, "Method has the right QName")
         harness.check(method.identifier.name, name, "Method has the right name")
         harness.check(method.isStatic(), static, "Method has the correct static value")
         harness.check(method.isGetter(), getter, "Method has the correct getter value")
         harness.check(method.isSetter(), setter, "Method has the correct setter value")
         harness.check(method.isDeleter(), deleter, "Method has the correct deleter value")
-        harness.check(method.isLegacycaller(), legacycaller, "Method has the correct legacycaller value")
-        harness.check(method.isStringifier(), stringifier, "Method has the correct stringifier value")
+        harness.check(method.isLegacycaller(), legacycaller,
+                      "Method has the correct legacycaller value")
+        harness.check(method.isStringifier(), stringifier,
+                      "Method has the correct stringifier value")
 
     harness.check(len(results), 2, "Expect 2 interfaces")
 
     iface = results[0]
     harness.check(len(iface.members), 6, "Expect 6 members")
 
     checkMethod(iface.members[0], "::SpecialMethods::__indexedgetter", "__indexedgetter",
                 getter=True)
@@ -49,25 +52,23 @@ def WebIDLTest(parser, harness):
                 deleter=True)
 
     iface = results[1]
     harness.check(len(iface.members), 1, "Expect 1 member")
 
     checkMethod(iface.members[0], "::SpecialMethodsCombination::__namedgetterdeleter",
                 "__namedgetterdeleter", getter=True, deleter=True)
 
-    parser = parser.reset();
+    parser = parser.reset()
 
     threw = False
     try:
         parser.parse(
             """
             interface IndexedDeleter {
               deleter void(unsigned long index);
             };
             """)
         parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "There are no indexed deleters")
-        
-        
--- a/dom/bindings/parser/tests/test_special_methods_uniqueness.py
+++ b/dom/bindings/parser/tests/test_special_methods_uniqueness.py
@@ -1,47 +1,45 @@
-import WebIDL
-
 def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodUniqueness1 {
               getter deleter boolean (DOMString name);
               getter boolean (DOMString name);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodUniqueness1 {
               deleter boolean (DOMString name);
               getter deleter boolean (DOMString name);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     threw = False
     try:
         parser.parse("""
             interface SpecialMethodUniqueness1 {
               setter boolean (DOMString name);
               setter boolean (DOMString name);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
--- a/dom/bindings/parser/tests/test_stringifier.py
+++ b/dom/bindings/parser/tests/test_stringifier.py
@@ -1,10 +1,11 @@
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     parser.parse("""
         interface TestStringifier {
           stringifier;
         };
     """)
 
     results = parser.finish()
@@ -18,29 +19,28 @@ def WebIDLTest(parser, harness):
     try:
         parser.parse("""
             interface TestStringifier {
               stringifier;
               stringifier;
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should not allow two 'stringifier;'")
 
     parser = parser.reset()
 
     threw = False
     try:
         parser.parse("""
             interface TestStringifier {
               stringifier;
               stringifier DOMString foo();
             };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should not allow a 'stringifier;' and a 'stringifier()'")
-
--- a/dom/bindings/parser/tests/test_toJSON.py
+++ b/dom/bindings/parser/tests/test_toJSON.py
@@ -2,100 +2,100 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse(
             """
             interface Test {
               object toJSON();
             };
             """)
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
     harness.ok(not threw, "Should allow a toJSON method.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
             interface Test {
               object toJSON(object arg);
               object toJSON(long arg);
             };
             """)
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
     harness.ok(threw, "Should not allow overloads of a toJSON method.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
             interface Test {
               object toJSON(object arg);
             };
             """)
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
     harness.ok(threw, "Should not allow a toJSON method with arguments.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
             interface Test {
               long toJSON();
             };
             """)
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
     harness.ok(not threw, "Should allow a toJSON method with 'long' as return type.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
             interface Test {
               [Default] object toJSON();
             };
             """)
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
     harness.ok(not threw, "Should allow a default toJSON method with 'object' as return type.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
             interface Test {
               [Default] long toJSON();
             };
             """)
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
     harness.ok(threw, "Should not allow a default toJSON method with non-'object' as return type.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse(
             """
             interface Test {
               any toJSON();
             };
             """)
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
     harness.ok(threw, "Should not allow a toJSON method with a non-JSON return type.")
 
     # We should probably write some tests here about what types are
     # considered JSON types.  Bug 1462537.
--- a/dom/bindings/parser/tests/test_treatNonCallableAsNull.py
+++ b/dom/bindings/parser/tests/test_treatNonCallableAsNull.py
@@ -1,10 +1,8 @@
-import WebIDL
-
 def WebIDLTest(parser, harness):
     parser.parse("""
         [TreatNonCallableAsNull] callback Function = any(any... arguments);
 
         interface TestTreatNonCallableAsNull1 {
           attribute Function? onfoo;
           attribute Function onbar;
         };
@@ -26,17 +24,17 @@ def WebIDLTest(parser, harness):
             callback Function = any(any... arguments);
 
             interface TestTreatNonCallableAsNull2 {
               [TreatNonCallableAsNull] attribute Function onfoo;
             };
         """)
 
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     parser = parser.reset()
 
     threw = False
     try:
@@ -45,27 +43,27 @@ def WebIDLTest(parser, harness):
 
             [TreatNonCallableAsNull]
             interface TestTreatNonCallableAsNull3 {
                attribute Function onfoo;
             };
         """)
 
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
 
     parser = parser.reset()
 
     threw = False
     try:
         parser.parse("""
             [TreatNonCallableAsNull, TreatNonObjectAsNull]
             callback Function = any(any... arguments);
         """)
 
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
--- a/dom/bindings/parser/tests/test_typedef.py
+++ b/dom/bindings/parser/tests/test_typedef.py
@@ -20,47 +20,47 @@ def WebIDLTest(parser, harness):
     try:
         parser.parse("""
           typedef long? mynullablelong;
           interface Foo {
             void foo(mynullablelong? Y);
           };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown on nullable inside nullable arg.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
           typedef long? mynullablelong;
           interface Foo {
             const mynullablelong? X = 5;
           };
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown on nullable inside nullable const.")
-    
+
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
           interface Foo {
             const mynullablelong? X = 5;
           };
           typedef long? mynullablelong;
         """)
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should have thrown on nullable inside nullable const typedef "
                "after interface.")
 
     parser = parser.reset()
     parser.parse("""
--- a/dom/bindings/parser/tests/test_unenumerable_own_properties.py
+++ b/dom/bindings/parser/tests/test_unenumerable_own_properties.py
@@ -5,46 +5,46 @@ def WebIDLTest(parser, harness):
         interface Foo {};
         [LegacyUnenumerableNamedProperties]
         interface Bar : Foo {
           getter long(DOMString name);
         };
         interface Baz : Bar {
           getter long(DOMString name);
         };
-        """);
-    results = parser.finish();
+        """)
+    results = parser.finish()
     harness.check(len(results), 3, "Should have three interfaces")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [LegacyUnenumerableNamedProperties]
             interface NoNamedGetter {
             };
         """)
 
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should have thrown.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [LegacyUnenumerableNamedProperties=Foo]
             interface ShouldNotHaveArg {
               getter long(DOMString name);
             };
         """)
 
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should have thrown.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             [LegacyUnenumerableNamedProperties]
@@ -54,11 +54,11 @@ def WebIDLTest(parser, harness):
             interface Bar : Foo {};
             [LegacyUnenumerableNamedProperties]
             interface Baz : Bar {
               getter long(DOMString name);
             };
         """)
 
         results = parser.finish()
-    except Exception, x:
+    except Exception:
         threw = True
     harness.ok(threw, "Should have thrown.")
--- a/dom/bindings/parser/tests/test_unforgeable.py
+++ b/dom/bindings/parser/tests/test_unforgeable.py
@@ -7,179 +7,179 @@ def WebIDLTest(parser, harness):
             };
         """)
 
     results = parser.finish()
     harness.check(len(results), 2,
                   "Should be able to inherit from an interface with "
                   "[Unforgeable] properties.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     parser.parse("""
             interface Child : Parent {
               const short foo = 10;
             };
             interface Parent {
               [Unforgeable] readonly attribute long foo;
             };
         """)
 
     results = parser.finish()
     harness.check(len(results), 2,
                   "Should be able to inherit from an interface with "
                   "[Unforgeable] properties even if we have a constant with "
                   "the same name.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     parser.parse("""
             interface Child : Parent {
               static attribute short foo;
             };
             interface Parent {
               [Unforgeable] readonly attribute long foo;
             };
         """)
 
     results = parser.finish()
     harness.check(len(results), 2,
                   "Should be able to inherit from an interface with "
                   "[Unforgeable] properties even if we have a static attribute "
                   "with the same name.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     parser.parse("""
             interface Child : Parent {
               static void foo();
             };
             interface Parent {
               [Unforgeable] readonly attribute long foo;
             };
         """)
 
     results = parser.finish()
     harness.check(len(results), 2,
                   "Should be able to inherit from an interface with "
                   "[Unforgeable] properties even if we have a static operation "
                   "with the same name.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface Child : Parent {
               void foo();
             };
             interface Parent {
               [Unforgeable] readonly attribute long foo;
             };
         """)
 
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should have thrown when shadowing unforgeable attribute on "
                "parent with operation.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface Child : Parent {
               void foo();
             };
             interface Parent {
               [Unforgeable] void foo();
             };
         """)
 
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should have thrown when shadowing unforgeable operation on "
                "parent with operation.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface Child : Parent {
               attribute short foo;
             };
             interface Parent {
               [Unforgeable] readonly attribute long foo;
             };
         """)
 
         results = parser.finish()
-    except Exception,x:
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should have thrown when shadowing unforgeable attribute on "
                "parent with attribute.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface Child : Parent {
               attribute short foo;
             };
             interface Parent {
               [Unforgeable] void foo();
             };
         """)
 
         results = parser.finish()
-    except Exception,x:
+    except Exception:
         threw = True
     harness.ok(threw,
                "Should have thrown when shadowing unforgeable operation on "
                "parent with attribute.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     parser.parse("""
             interface Child : Parent {
             };
             interface Parent {};
             interface Consequential {
               [Unforgeable] readonly attribute long foo;
             };
             Parent implements Consequential;
         """)
 
     results = parser.finish()
     harness.check(len(results), 4,
                   "Should be able to inherit from an interface with a "
                   "consequential interface with [Unforgeable] properties.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface Child : Parent {
               void foo();
             };
             interface Parent {};
             interface Consequential {
               [Unforgeable] readonly attribute long foo;
             };
             Parent implements Consequential;
         """)
 
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should have thrown when shadowing unforgeable attribute "
                "of parent's consequential interface.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface Child : Parent {
             };
             interface Parent : GrandParent {};
             interface GrandParent {};
             interface Consequential {
@@ -188,24 +188,24 @@ def WebIDLTest(parser, harness):
             GrandParent implements Consequential;
             interface ChildConsequential {
               void foo();
             };
             Child implements ChildConsequential;
         """)
 
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should have thrown when our consequential interface shadows unforgeable attribute "
                "of ancestor's consequential interface.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface Child : Parent {
             };
             interface Parent : GrandParent {};
             interface GrandParent {};
             interface Consequential {
@@ -214,40 +214,40 @@ def WebIDLTest(parser, harness):
             GrandParent implements Consequential;
             interface ChildConsequential {
               void foo();
             };
             Child implements ChildConsequential;
         """)
 
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should have thrown when our consequential interface shadows unforgeable operation "
                "of ancestor's consequential interface.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     parser.parse("""
         interface iface {
           [Unforgeable] attribute long foo;
         };
     """)
 
     results = parser.finish()
     harness.check(len(results), 1,
                   "Should allow writable [Unforgeable] attribute.")
 
-    parser = parser.reset();
+    parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface iface {
               [Unforgeable] static readonly attribute long foo;
             };
         """)
 
         results = parser.finish()
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown for static [Unforgeable] attribute.")
--- a/dom/bindings/parser/tests/test_union.py
+++ b/dom/bindings/parser/tests/test_union.py
@@ -1,20 +1,22 @@
-import WebIDL
-import itertools
 import string
 
 # We'd like to use itertools.chain but it's 2.6 or higher.
+
+
 def chain(*iterables):
     # chain('ABC', 'DEF') --> A B C D E F
     for it in iterables:
         for element in it:
             yield element
 
 # We'd like to use itertools.combinations but it's 2.6 or higher.
+
+
 def combinations(iterable, r):
     # combinations('ABCD', 2) --> AB AC AD BC BD CD
     # combinations(range(4), 3) --> 012 013 023 123
     pool = tuple(iterable)
     n = len(pool)
     if r > n:
         return
     indices = range(r)
@@ -27,16 +29,18 @@ def combinations(iterable, r):
             return
         indices[i] += 1
         for j in range(i+1, r):
             indices[j] = indices[j-1] + 1
         yield tuple(pool[i] for i in indices)
 
 # We'd like to use itertools.combinations_with_replacement but it's 2.7 or
 # higher.
+
+
 def combinations_with_replacement(iterable, r):
     # combinations_with_replacement('ABC', 2) --> AA AB AC BB BC CC
     pool = tuple(iterable)
     n = len(pool)
     if not n and r:
         return
     indices = [0] * r
     yield tuple(pool[i] for i in indices)
@@ -44,35 +48,36 @@ def combinations_with_replacement(iterab
         for i in reversed(range(r)):
             if indices[i] != n - 1:
                 break
         else:
             return
         indices[i:] = [indices[i] + 1] * (r - i)
         yield tuple(pool[i] for i in indices)
 
+
 def WebIDLTest(parser, harness):
     types = ["float",
              "double",
              "short",
              "unsigned short",
              "long",
              "unsigned long",
              "long long",
              "unsigned long long",
              "boolean",
              "byte",
              "octet",
              "DOMString",
              "ByteString",
              "USVString",
-             #"sequence<float>",
+             # "sequence<float>",
              "object",
              "ArrayBuffer",
-             #"Date",
+             # "Date",
              "TestInterface1",
              "TestInterface2"]
 
     testPre = """
         interface TestInterface1 {
         };
         interface TestInterface2 {
         };
@@ -93,18 +98,20 @@ def WebIDLTest(parser, harness):
     results = parser.finish()
 
     iface = results[2]
 
     parser = parser.reset()
 
     def typesAreDistinguishable(t):
         return all(u[0].isDistinguishableFrom(u[1]) for u in combinations(t, 2))
+
     def typesAreNotDistinguishable(t):
         return any(not u[0].isDistinguishableFrom(u[1]) for u in combinations(t, 2))
+
     def unionTypeName(t):
         if len(t) > 2:
             t[0:2] = [unionTypeName(t[0:2])]
         return "(" + " or ".join(t) + ")"
 
     # typeCombinations is an iterable of tuples containing the name of the type
     # as a string and the parsed IDL type.
     def unionTypes(typeCombinations, predicate):
@@ -124,17 +131,18 @@ def WebIDLTest(parser, harness):
                 yield unionTypeName([t[0] for t in c])
 
     # Create a list of tuples containing the name of the type as a string and
     # the parsed IDL type.
     types = zip(types, (a.type for a in iface.members))
 
     validUnionTypes = chain(unionTypes(combinations(types, 2), typesAreDistinguishable),
                             unionTypes(combinations(types, 3), typesAreDistinguishable))
-    invalidUnionTypes = chain(unionTypes(combinations_with_replacement(types, 2), typesAreNotDistinguishable),
+    invalidUnionTypes = chain(unionTypes(combinations_with_replacement(types, 2),
+                                         typesAreNotDistinguishable),
                               invalidUnionWithUnion(combinations(types, 3)))
     interface = testPre + """
         interface TestUnion {
         """
     for (i, type) in enumerate(validUnionTypes):
         interface += string.Template("""
           void method${i}(${type} arg);
           ${type} returnMethod${i}();
@@ -155,14 +163,14 @@ def WebIDLTest(parser, harness):
               void method(${type} arg);
             };
         """).substitute(type=invalid)
 
         threw = False
         try:
             parser.parse(interface)
             results = parser.finish()
-        except:
+        except Exception:
             threw = True
 
         harness.ok(threw, "Should have thrown.")
 
         parser = parser.reset()
--- a/dom/bindings/parser/tests/test_union_any.py
+++ b/dom/bindings/parser/tests/test_union_any.py
@@ -2,13 +2,13 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface AnyNotInUnion {
               void foo((any or DOMString) arg);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
--- a/dom/bindings/parser/tests/test_union_nullable.py
+++ b/dom/bindings/parser/tests/test_union_nullable.py
@@ -2,35 +2,35 @@ def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface OneNullableInUnion {
               void foo((object? or DOMString?) arg);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Two nullable member types of a union should have thrown.")
 
     parser.reset()
     threw = False
 
     try:
         parser.parse("""
             interface NullableInNullableUnion {
               void foo((object? or DOMString)? arg);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "A nullable union type with a nullable member type should have "
                "thrown.")
 
     parser.reset()
     threw = False
@@ -39,15 +39,15 @@ def WebIDLTest(parser, harness):
         parser.parse("""
             interface NullableInUnionNullableUnionHelper {
             };
             interface NullableInUnionNullableUnion {
               void foo(((object? or DOMString) or NullableInUnionNullableUnionHelper)? arg);
             };
         """)
 
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "A nullable union type with a nullable member type should have "
                "thrown.")
--- a/dom/bindings/parser/tests/test_usvstring.py
+++ b/dom/bindings/parser/tests/test_usvstring.py
@@ -1,20 +1,21 @@
 # -*- coding: UTF-8 -*-
 
 import WebIDL
 
+
 def WebIDLTest(parser, harness):
     parser.parse("""
         interface TestUSVString {
           attribute USVString svs;
         };
     """)
 
-    results = parser.finish();
+    results = parser.finish()
 
     harness.check(len(results), 1, "Should be one production")
     harness.ok(isinstance(results[0], WebIDL.IDLInterface),
                "Should be an IDLInterface")
     iface = results[0]
     harness.check(iface.identifier.QName(), "::TestUSVString",
                   "Interface has the right QName")
     harness.check(iface.identifier.name, "TestUSVString",
--- a/dom/bindings/parser/tests/test_variadic_callback.py
+++ b/dom/bindings/parser/tests/test_variadic_callback.py
@@ -1,10 +1,8 @@
-import WebIDL
-
 def WebIDLTest(parser, harness):
     parser.parse("""
         callback TestVariadicCallback = any(any... arguments);
     """)
 
-    results = parser.finish()
+    parser.finish()
 
     harness.ok(True, "TestVariadicCallback callback parsed without error.")
--- a/dom/bindings/parser/tests/test_variadic_constraints.py
+++ b/dom/bindings/parser/tests/test_variadic_constraints.py
@@ -1,63 +1,63 @@
 def WebIDLTest(parser, harness):
     threw = False
     try:
         parser.parse("""
             interface VariadicConstraints1 {
               void foo(byte... arg1, byte arg2);
             };
         """)
-        results = parser.finish()
+        parser.finish()
 
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should have thrown on variadic argument followed by required "
                "argument.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface VariadicConstraints2 {
               void foo(byte... arg1, optional byte arg2);
             };
         """)
-        results = parser.finish();
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should have thrown on variadic argument followed by optional "
                "argument.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface VariadicConstraints3 {
               void foo(optional byte... arg1);
             };
         """)
-        results = parser.finish()
+        parser.finish()
 
-    except:
+    except Exception:
         threw = True
 
     harness.ok(threw,
                "Should have thrown on variadic argument explicitly flagged as "
                "optional.")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
             interface VariadicConstraints4 {
               void foo(byte... arg1 = 0);
             };
         """)
-        results = parser.finish()
-    except:
+        parser.finish()
+    except Exception:
         threw = True
 
     harness.ok(threw, "Should have thrown on variadic argument with default value.")
--- a/dom/browser-element/mochitest/createNewTest.py
+++ b/dom/browser-element/mochitest/createNewTest.py
@@ -66,17 +66,18 @@ def add_to_ini(filename, test, support_f
         lines_to_write += ['support-files = {0}'.format(support_file)]
     lines_to_write += ['']
     with open(filename, 'a') as f:
         f.write('\n'.join(lines_to_write))
 
     if 'EDITOR' not in os.environ or not os.environ['EDITOR']:
         print_fill("""\
             Now open {filename} and move the filenames to their correct places.")
-            (Define $EDITOR and I'll open your editor for you next time.)""".format(filename=filename))
+            (Define $EDITOR and I'll open your editor for you next time.)""".format(
+                filename=filename))
         return
 
     # Count the number of lines in the file
     with open(filename, 'r') as f:
         num_lines = len(f.readlines())
 
     try:
         subprocess.call([os.environ['EDITOR'],
@@ -99,17 +100,17 @@ def main(test_name, bug_number):
     def create_file(filename, template):
         path = os.path.join(os.path.dirname(sys.argv[0]), format(filename))
         # Create a new file, bailing with an error if the file exists.
         fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL)
 
         try:
             # This file has 777 permission when created, for whatever reason.  Make it rw-rw-r---.
             os.fchmod(fd, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IWGRP | stat.S_IROTH)
-        except:
+        except Exception:
             # fchmod doesn't work on Windows.
             pass
 
         with os.fdopen(fd, 'w') as file:
             file.write(format(template))
 
     create_file('browserElement_{test}.js', js_template)
     create_file('test_browserElement_inproc_{test}.html', html_template)
--- a/dom/canvas/test/webgl-conf/checkout/conformance/ogles/process-ogles2-tests.py
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/ogles/process-ogles2-tests.py
@@ -7,18 +7,18 @@ import os.path
 import sys
 import re
 import json
 import shutil
 from optparse import OptionParser
 from xml.dom.minidom import parse
 
 if sys.version < '2.6':
-   print 'Wrong Python Version !!!: Need >= 2.6'
-   sys.exit(1)
+    print 'Wrong Python Version !!!: Need >= 2.6'
+    sys.exit(1)
 
 # each shader test generates up to 3 512x512 images.
 # a 512x512 image takes 1meg of memory so set this
 # number apporpriate for the platform with
 # the smallest memory issue. At 8 that means
 # at least 24 meg is needed to run the test.
 MAX_TESTS_PER_SET = 8
 
@@ -94,276 +94,278 @@ VALID_UNIFORM_TYPES = [
 
 SUBSTITUTIONS = [
   ("uniformmat3fv", "uniformMatrix3fv"),
   ("uniformmat4fv", "uniformMatrix4fv"),
 ]
 
 
 def Log(msg):
-  global VERBOSE
-  if VERBOSE:
-    print msg
+    global VERBOSE
+    if VERBOSE:
+        print msg
 
 
 def TransposeMatrix(values, dim):
-  size = dim * dim
-  count = len(values) / size
-  for m in range(0, count):
-    offset = m * size
-    for i in range(0, dim):
-      for j in range(i + 1, dim):
-        t = values[offset + i * dim + j]
-        values[offset + i * dim + j] = values[offset + j * dim + i]
-        values[offset + j * dim + i] = t
+    size = dim * dim
+    count = len(values) / size
+    for m in range(0, count):
+        offset = m * size
+        for i in range(0, dim):
+            for j in range(i + 1, dim):
+                t = values[offset + i * dim + j]
+                values[offset + i * dim + j] = values[offset + j * dim + i]
+                values[offset + j * dim + i] = t
 
 
 def GetValidTypeName(type_name):
-  global VALID_UNIFORM_TYPES
-  global SUBSTITUTIONS
-  for subst in SUBSTITUTIONS:
-    type_name = type_name.replace(subst[0], subst[1])
-  if not type_name in VALID_UNIFORM_TYPES:
-    print "unknown type name: ", type_name
-    raise SyntaxError
-  return type_name
+    global VALID_UNIFORM_TYPES
+    global SUBSTITUTIONS
+    for subst in SUBSTITUTIONS:
+        type_name = type_name.replace(subst[0], subst[1])
+    if type_name not in VALID_UNIFORM_TYPES:
+        print("unknown type name: ", type_name)
+        raise SyntaxError
+    return type_name
 
 
 def WriteOpen(filename):
-  dirname = os.path.dirname(filename)
-  if len(dirname) > 0 and not os.path.exists(dirname):
-    os.makedirs(dirname)
-  return open(filename, "wb")
+    dirname = os.path.dirname(filename)
+    if len(dirname) > 0 and not os.path.exists(dirname):
+        os.makedirs(dirname)
+    return open(filename, "wb")
 
 
 class TxtWriter():
-  def __init__(self, filename):
-    self.filename = filename
-    self.lines = []
+    def __init__(self, filename):
+        self.filename = filename
+        self.lines = []
 
-  def Write(self, line):
-    self.lines.append(line)
+    def Write(self, line):
+        self.lines.append(line)
 
-  def Close(self):
-    if len(self.lines) > 0:
-      Log("Writing: %s" % self.filename)
-      f = WriteOpen(self.filename)
-      f.write("# this file is auto-generated. DO NOT EDIT.\n")
-      f.write("".join(self.lines))
-      f.close()
+    def Close(self):
+        if len(self.lines) > 0:
+            Log("Writing: %s" % self.filename)
+            f = WriteOpen(self.filename)
+            f.write("# this file is auto-generated. DO NOT EDIT.\n")
+            f.write("".join(self.lines))
+            f.close()
 
 
 def ReadFileAsLines(filename):
-  f = open(filename, "r")
-  lines = f.readlines()
-  f.close()
-  return [line.strip() for line in lines]
+    f = open(filename, "r")
+    lines = f.readlines()
+    f.close()
+    return [line.strip() for line in lines]
 
 
 def ReadFile(filename):
-  f = open(filename, "r")
-  content = f.read()
-  f.close()
-  return content.replace("\r\n", "\n")
+    f = open(filename, "r")
+    content = f.read()
+    f.close()
+    return content.replace("\r\n", "\n")
 
 
 def Chunkify(list, chunk_size):
-  """divides an array into chunks of chunk_size"""
-  return [list[i:i + chunk_size] for i in range(0, len(list), chunk_size)]
+    """divides an array into chunks of chunk_size"""
+    return [list[i:i + chunk_size] for i in range(0, len(list), chunk_size)]
 
 
 def GetText(nodelist):
-  """Gets the text of from a list of nodes"""
-  rc = []
-  for node in nodelist:
-    if node.nodeType == node.TEXT_NODE:
-      rc.append(node.data)
-  return ''.join(rc)
+    """Gets the text of from a list of nodes"""
+    rc = []
+    for node in nodelist:
+        if node.nodeType == node.TEXT_NODE:
+            rc.append(node.data)
+    return ''.join(rc)
 
 
 def GetElementText(node, name):
-  """Gets the text of an element"""
-  elements = node.getElementsByTagName(name)
-  if len(elements) > 0:
-    return GetText(elements[0].childNodes)
-  else:
-    return None
+    """Gets the text of an element"""
+    elements = node.getElementsByTagName(name)
+    if len(elements) > 0:
+        return GetText(elements[0].childNodes)
+    else:
+        return None
 
 
 def GetBoolElement(node, name):
-  text = GetElementText(node, name)
-  return text.lower() == "true"
+    text = GetElementText(node, name)
+    return text.lower() == "true"
 
 
 def GetModel(node):
-  """Gets the model"""
-  model = GetElementText(node, "model")
-  if model and len(model.strip()) == 0:
-    elements = node.getElementsByTagName("model")
-    if len(elements) > 0:
-      model = GetElementText(elements[0], "filename")
-  return model
+    """Gets the model"""
+    model = GetElementText(node, "model")
+    if model and len(model.strip()) == 0:
+        elements = node.getElementsByTagName("model")
+        if len(elements) > 0:
+            model = GetElementText(elements[0], "filename")
+    return model
 
 
 def RelativizePaths(base, paths, template):
-  """converts paths to relative paths"""
-  rels = []
-  for p in paths:
-    #print "---"
-    #print "base: ", os.path.abspath(base)
-    #print "path: ", os.path.abspath(p)
-    relpath = os.path.relpath(os.path.abspath(p), os.path.dirname(os.path.abspath(base))).replace("\\", "/")
-    #print "rel : ", relpath
-    rels.append(template % relpath)
-  return "\n".join(rels)
+    """converts paths to relative paths"""
+    rels = []
+    for p in paths:
+        # print "---"
+        # print "base: ", os.path.abspath(base)
+        # print "path: ", os.path.abspath(p)
+        relpath = os.path.relpath(os.path.abspath(p), os.path.dirname(
+            os.path.abspath(base))).replace("\\", "/")
+        # print "rel : ", relpath
+        rels.append(template % relpath)
+    return "\n".join(rels)
 
 
 def CopyFile(filename, src, dst):
-  s = os.path.abspath(os.path.join(os.path.dirname(src), filename))
-  d = os.path.abspath(os.path.join(os.path.dirname(dst), filename))
-  dst_dir = os.path.dirname(d)
-  if not os.path.exists(dst_dir):
-    os.makedirs(dst_dir)
-  shutil.copyfile(s, d)
+    s = os.path.abspath(os.path.join(os.path.dirname(src), filename))
+    d = os.path.abspath(os.path.join(os.path.dirname(dst), filename))
+    dst_dir = os.path.dirname(d)
+    if not os.path.exists(dst_dir):
+        os.makedirs(dst_dir)
+    shutil.copyfile(s, d)
 
 
 def CopyShader(filename, src, dst):
-  s = os.path.abspath(os.path.join(os.path.dirname(src), filename))
-  d = os.path.abspath(os.path.join(os.path.dirname(dst), filename))
-  text = ReadFile(s)
-  # By agreement with the Khronos OpenGL working group we are allowed
-  # to open source only the .vert and .frag files from the OpenGL ES 2.0
-  # conformance tests. All other files from the OpenGL ES 2.0 conformance
-  # tests are not included.
-  marker = "insert-copyright-here"
-  new_text = COMMENT_RE.sub(marker, text)
-  if new_text == text:
-    print "no matching license found:", s
-    raise RuntimeError
-  new_text = REMOVE_COPYRIGHT_RE.sub("", new_text)
-  new_text = new_text.replace(marker, LICENSE)
-  f = WriteOpen(d)
-  f.write(new_text)
-  f.close()
+    s = os.path.abspath(os.path.join(os.path.dirname(src), filename))
+    d = os.path.abspath(os.path.join(os.path.dirname(dst), filename))
+    text = ReadFile(s)
+    # By agreement with the Khronos OpenGL working group we are allowed
+    # to open source only the .vert and .frag files from the OpenGL ES 2.0
+    # conformance tests. All other files from the OpenGL ES 2.0 conformance
+    # tests are not included.
+    marker = "insert-copyright-here"
+    new_text = COMMENT_RE.sub(marker, text)
+    if new_text == text:
+        print "no matching license found:", s
+        raise RuntimeError
+    new_text = REMOVE_COPYRIGHT_RE.sub("", new_text)
+    new_text = new_text.replace(marker, LICENSE)
+    f = WriteOpen(d)
+    f.write(new_text)
+    f.close()
 
 
 def IsOneOf(string, regexs):
-  for regex in regexs:
-    if re.match(regex, string):
-      return True
-  return False
+    for regex in regexs:
+        if re.match(regex, string):
+            return True
+    return False
 
 
 def CheckForUnknownTags(valid_tags, node, depth=1):
-  """do a hacky check to make sure we're not missing something."""
-  for child in node.childNodes:
-    if child.localName and not IsOneOf(child.localName, valid_tags[0]):
-      print "unsupported tag:", child.localName
-      print "depth:", depth
-      raise SyntaxError
-    else:
-      if len(valid_tags) > 1:
-        CheckForUnknownTags(valid_tags[1:], child, depth + 1)
+    """do a hacky check to make sure we're not missing something."""
+    for child in node.childNodes:
+        if child.localName and not IsOneOf(child.localName, valid_tags[0]):
+            print "unsupported tag:", child.localName
+            print "depth:", depth
+            raise SyntaxError
+        else:
+            if len(valid_tags) > 1:
+                CheckForUnknownTags(valid_tags[1:], child, depth + 1)
 
 
 def IsFileWeWant(filename):
-  for f in FILTERS:
-    if f.search(filename):
-      return True
-  return False
+    for f in FILTERS:
+        if f.search(filename):
+            return True
+    return False
 
 
 class TestReader():
-  """class to read and parse tests"""
+    """class to read and parse tests"""
 
-  def __init__(self, basepath):
-    self.tests = []
-    self.modes = {}
-    self.patterns = {}
-    self.basepath = basepath
+    def __init__(self, basepath):
+        self.tests = []
+        self.modes = {}
+        self.patterns = {}
+        self.basepath = basepath
 
-  def Print(self, msg):
-    if self.verbose:
-      print msg
+    def Print(self, msg):
+        if self.verbose:
+            print msg
 
-  def MakeOutPath(self, filename):
-    relpath = os.path.relpath(os.path.abspath(filename), os.path.dirname(os.path.abspath(self.basepath)))
-    return relpath
+    def MakeOutPath(self, filename):
+        relpath = os.path.relpath(os.path.abspath(
+            filename), os.path.dirname(os.path.abspath(self.basepath)))
+        return relpath
 
-  def ReadTests(self, filename):
-    """reads a .run file and parses."""
-    Log("reading %s" % filename)
-    outname = self.MakeOutPath(filename + ".txt")
-    f = TxtWriter(outname)
-    dirname = os.path.dirname(filename)
-    lines = ReadFileAsLines(filename)
-    count = 0
-    tests_data = []
-    for line in lines:
-      if len(line) > 0 and not line.startswith("#"):
-        fname = os.path.join(dirname, line)
-        if line.endswith(".run"):
-          if self.ReadTests(fname):
-            f.Write(line + ".txt\n")
+    def ReadTests(self, filename):
+        """reads a .run file and parses."""
+        Log("reading %s" % filename)
+        outname = self.MakeOutPath(filename + ".txt")
+        f = TxtWriter(outname)
+        dirname = os.path.dirname(filename)
+        lines = ReadFileAsLines(filename)
+        count = 0
+        tests_data = []
+        for line in lines:
+            if len(line) > 0 and not line.startswith("#"):
+                fname = os.path.join(dirname, line)
+                if line.endswith(".run"):
+                    if self.ReadTests(fname):
+                        f.Write(line + ".txt\n")
+                        count += 1
+                elif line.endswith(".test"):
+                    tests_data.extend(self.ReadTest(fname))
+                else:
+                    print "Error in %s:%d:%s" % (filename, count, line)
+                    raise SyntaxError()
+        if len(tests_data):
+            global MAX_TESTS_PER_SET
+            sets = Chunkify(tests_data, MAX_TESTS_PER_SET)
+            id = 1
+            for set in sets:
+                suffix = "_%03d_to_%03d" % (id, id + len(set) - 1)
+                test_outname = self.MakeOutPath(filename + suffix + ".html")
+                if os.path.basename(test_outname).startswith("input.run"):
+                    dname = os.path.dirname(test_outname)
+                    folder_name = os.path.basename(dname)
+                    test_outname = os.path.join(dname, folder_name + suffix + ".html")
+                self.WriteTests(filename, test_outname, {"tests": set})
+                f.Write(os.path.basename(test_outname) + "\n")
+                id += len(set)
             count += 1
-        elif line.endswith(".test"):
-          tests_data.extend(self.ReadTest(fname))
-        else:
-          print "Error in %s:%d:%s" % (filename, count, line)
-          raise SyntaxError()
-    if len(tests_data):
-      global MAX_TESTS_PER_SET
-      sets = Chunkify(tests_data, MAX_TESTS_PER_SET)
-      id = 1
-      for set in sets:
-        suffix = "_%03d_to_%03d" % (id, id + len(set) - 1)
-        test_outname = self.MakeOutPath(filename + suffix + ".html")
-        if os.path.basename(test_outname).startswith("input.run"):
-          dname = os.path.dirname(test_outname)
-          folder_name = os.path.basename(dname)
-          test_outname = os.path.join(dname, folder_name + suffix + ".html")
-        self.WriteTests(filename, test_outname, {"tests":set})
-        f.Write(os.path.basename(test_outname) + "\n")
-        id += len(set)
-      count += 1
-    f.Close()
-    return count
+        f.Close()
+        return count
 
-  def ReadTest(self, filename):
-    """reads a .test file and parses."""
-    Log("reading %s" % filename)
-    dom = parse(filename)
-    tests = dom.getElementsByTagName("test")
-    tests_data = []
-    outname = self.MakeOutPath(filename + ".html")
-    for test in tests:
-      if not IsFileWeWant(filename):
-        self.CopyShaders(test, filename, outname)
-      else:
-        test_data = self.ProcessTest(test, filename, outname, len(tests_data))
-        if test_data:
-          tests_data.append(test_data)
-    return tests_data
+    def ReadTest(self, filename):
+        """reads a .test file and parses."""
+        Log("reading %s" % filename)
+        dom = parse(filename)
+        tests = dom.getElementsByTagName("test")
+        tests_data = []
+        outname = self.MakeOutPath(filename + ".html")
+        for test in tests:
+            if not IsFileWeWant(filename):
+                self.CopyShaders(test, filename, outname)
+            else:
+                test_data = self.ProcessTest(test, filename, outname, len(tests_data))
+                if test_data:
+                    tests_data.append(test_data)
+        return tests_data
 
-  def ProcessTest(self, test, filename, outname, id):
-    """Process a test"""
-    mode = test.getAttribute("mode")
-    pattern = test.getAttribute("pattern")
-    self.modes[mode] = 1
-    self.patterns[pattern] = 1
-    Log ("%d: mode: %s pattern: %s" % (id, mode, pattern))
-    method = getattr(self, 'Process_' + pattern)
-    test_data = method(test, filename, outname)
-    if test_data:
-      test_data["pattern"] = pattern
-    return test_data
+    def ProcessTest(self, test, filename, outname, id):
+        """Process a test"""
+        mode = test.getAttribute("mode")
+        pattern = test.getAttribute("pattern")
+        self.modes[mode] = 1
+        self.patterns[pattern] = 1
+        Log("%d: mode: %s pattern: %s" % (id, mode, pattern))
+        method = getattr(self, 'Process_' + pattern)
+        test_data = method(test, filename, outname)
+        if test_data:
+            test_data["pattern"] = pattern
+        return test_data
 
-  def WriteTests(self, filename, outname, tests_data):
-    Log("Writing %s" % outname)
-    template = """<!DOCTYPE html>
+    def WriteTests(self, filename, outname, tests_data):
+        Log("Writing %s" % outname)
+        template = """<!DOCTYPE html>
 <!-- this file is auto-generated. DO NOT EDIT.
 %(license)s
 -->
 <html>
 <head>
 <meta charset="utf-8">
 <title>WebGL GLSL conformance test: %(title)s</title>
 %(css)s
@@ -376,211 +378,210 @@ class TestReader():
 </body>
 <script>
 "use strict";
 OpenGLESTestRunner.run(%(tests_data)s);
 var successfullyParsed = true;
 </script>
 </html>
 """
-    css = [
-      "../../resources/js-test-style.css",
-      "../../resources/ogles-tests.css",
-    ]
-    scripts = [
-      "../../resources/js-test-pre.js",
-      "../../resources/webgl-test-utils.js",
-      "ogles-utils.js",
-    ]
-    css_html = RelativizePaths(outname, css, '<link rel="stylesheet" href="%s" />')
-    scripts_html = RelativizePaths(outname, scripts, '<script src="%s"></script>')
+        css = [
+          "../../resources/js-test-style.css",
+          "../../resources/ogles-tests.css",
+        ]
+        scripts = [
+          "../../resources/js-test-pre.js",
+          "../../resources/webgl-test-utils.js",
+          "ogles-utils.js",
+        ]
+        css_html = RelativizePaths(outname, css, '<link rel="stylesheet" href="%s" />')
+        scripts_html = RelativizePaths(outname, scripts, '<script src="%s"></script>')
 
-    f = WriteOpen(outname)
-    f.write(template % {
-        "license": LICENSE,
-        "css": css_html,
-        "scripts": scripts_html,
-        "title": os.path.basename(outname),
-        "tests_data": json.dumps(tests_data, indent=2)
-      })
-    f.close()
-
+        f = WriteOpen(outname)
+        f.write(template % {
+            "license": LICENSE,
+            "css": css_html,
+            "scripts": scripts_html,
+            "title": os.path.basename(outname),
+            "tests_data": json.dumps(tests_data, indent=2)
+          })
+        f.close()
 
-  def CopyShaders(self, test, filename, outname):
-    """For tests we don't actually support yet, at least copy the shaders"""
-    shaders = test.getElementsByTagName("shader")
-    for shader in shaders:
-      for name in ["vertshader", "fragshader"]:
-        s = GetElementText(shader, name)
-        if s and s != "empty":
-          CopyShader(s, filename, outname)
+    def CopyShaders(self, test, filename, outname):
+        """For tests we don't actually support yet, at least copy the shaders"""
+        shaders = test.getElementsByTagName("shader")
+        for shader in shaders:
+            for name in ["vertshader", "fragshader"]:
+                s = GetElementText(shader, name)
+                if s and s != "empty":
+                    CopyShader(s, filename, outname)
 
-  #
-  # pattern handlers.
-  #
+    #
+    # pattern handlers.
+    #
 
-  def Process_compare(self, test, filename, outname):
-    global MATRIX_RE
+    def Process_compare(self, test, filename, outname):
+        global MATRIX_RE
 
-    valid_tags = [
-      ["shader", "model", "glstate"],
-      ["uniform", "vertshader", "fragshader", "filename", "depthrange"],
-      ["name", "count", "transpose", "uniform*", "near", "far"],
-    ]
-    CheckForUnknownTags(valid_tags, test)
+        valid_tags = [
+          ["shader", "model", "glstate"],
+          ["uniform", "vertshader", "fragshader", "filename", "depthrange"],
+          ["name", "count", "transpose", "uniform*", "near", "far"],
+        ]
+        CheckForUnknownTags(valid_tags, test)
 
-    # parse the test
-    shaders = test.getElementsByTagName("shader")
-    shaderInfos = []
-    for shader in shaders:
-      v = GetElementText(shader, "vertshader")
-      f = GetElementText(shader, "fragshader")
-      CopyShader(v, filename, outname)
-      CopyShader(f, filename, outname)
-      info = {
-        "vertexShader": v,
-        "fragmentShader": f,
-      }
-      shaderInfos.append(info)
-      uniformElems = shader.getElementsByTagName("uniform")
-      if len(uniformElems) > 0:
-        uniforms = {}
-        info["uniforms"] = uniforms
-        for uniformElem in uniformElems:
-          uniform = {"count": 1}
-          for child in uniformElem.childNodes:
-            if child.localName == None:
-              pass
-            elif child.localName == "name":
-              uniforms[GetText(child.childNodes)] = uniform
-            elif child.localName == "count":
-              uniform["count"] = int(GetText(child.childNodes))
-            elif child.localName == "transpose":
-              uniform["transpose"] = (GetText(child.childNodes) == "true")
-            else:
-              if "type" in uniform:
-                print "utype was:", uniform["type"], " found ", child.localName
-                raise SyntaxError
-              type_name = GetValidTypeName(child.localName)
-              uniform["type"] = type_name
-              valueText = GetText(child.childNodes).replace(",", " ")
-              uniform["value"] = [float(t) for t in valueText.split()]
-              m = MATRIX_RE.search(type_name)
-              if m:
-                # Why are these backward from the API?!?!?
-                TransposeMatrix(uniform["value"], int(m.group(1)))
-    data = {
-      "name": os.path.basename(outname),
-      "model": GetModel(test),
-      "referenceProgram": shaderInfos[1],
-      "testProgram": shaderInfos[0],
-    }
-    gl_states = test.getElementsByTagName("glstate")
-    if len(gl_states) > 0:
-      state = {}
-      data["state"] = state
-      for gl_state in gl_states:
-        for state_name in gl_state.childNodes:
-          if state_name.localName:
-            values = {}
-            for field in state_name.childNodes:
-              if field.localName:
-                values[field.localName] = GetText(field.childNodes)
-            state[state_name.localName] = values
-    return data
+        # parse the test
+        shaders = test.getElementsByTagName("shader")
+        shaderInfos = []
+        for shader in shaders:
+            v = GetElementText(shader, "vertshader")
+            f = GetElementText(shader, "fragshader")
+            CopyShader(v, filename, outname)
+            CopyShader(f, filename, outname)
+            info = {
+              "vertexShader": v,
+              "fragmentShader": f,
+            }
+            shaderInfos.append(info)
+            uniformElems = shader.getElementsByTagName("uniform")
+            if len(uniformElems) > 0:
+                uniforms = {}
+                info["uniforms"] = uniforms
+                for uniformElem in uniformElems:
+                    uniform = {"count": 1}
+                    for child in uniformElem.childNodes:
+                        if child.localName is None:
+                            pass
+                        elif child.localName == "name":
+                            uniforms[GetText(child.childNodes)] = uniform
+                        elif child.localName == "count":
+                            uniform["count"] = int(GetText(child.childNodes))
+                        elif child.localName == "transpose":
+                            uniform["transpose"] = (GetText(child.childNodes) == "true")
+                        else:
+                            if "type" in uniform:
+                                print "utype was:", uniform["type"], " found ", child.localName
+                                raise SyntaxError
+                            type_name = GetValidTypeName(child.localName)
+                            uniform["type"] = type_name
+                            valueText = GetText(child.childNodes).replace(",", " ")
+                            uniform["value"] = [float(t) for t in valueText.split()]
+                            m = MATRIX_RE.search(type_name)
+                            if m:
+                                # Why are these backward from the API?!?!?
+                                TransposeMatrix(uniform["value"], int(m.group(1)))
+        data = {
+          "name": os.path.basename(outname),
+          "model": GetModel(test),
+          "referenceProgram": shaderInfos[1],
+          "testProgram": shaderInfos[0],
+        }
+        gl_states = test.getElementsByTagName("glstate")
+        if len(gl_states) > 0:
+            state = {}
+            data["state"] = state
+            for gl_state in gl_states:
+                for state_name in gl_state.childNodes:
+                    if state_name.localName:
+                        values = {}
+                        for field in state_name.childNodes:
+                            if field.localName:
+                                values[field.localName] = GetText(field.childNodes)
+                        state[state_name.localName] = values
+        return data
 
-  def Process_shaderload(self, test, filename, outname):
-    """no need for shaderload tests"""
-    self.CopyShaders(test, filename, outname)
+    def Process_shaderload(self, test, filename, outname):
+        """no need for shaderload tests"""
+        self.CopyShaders(test, filename, outname)
 
-  def Process_extension(self, test, filename, outname):
-    """no need for extension tests"""
-    self.CopyShaders(test, filename, outname)
+    def Process_extension(self, test, filename, outname):
+        """no need for extension tests"""
+        self.CopyShaders(test, filename, outname)
 
-  def Process_createtests(self, test, filename, outname):
-    Log("createtests Not implemented:  %s" % filename)
-    self.CopyShaders(test, filename, outname)
+    def Process_createtests(self, test, filename, outname):
+        Log("createtests Not implemented:  %s" % filename)
+        self.CopyShaders(test, filename, outname)
 
-  def Process_GL2Test(self, test, filename, outname):
-    Log("GL2Test Not implemented:  %s" % filename)
-    self.CopyShaders(test, filename, outname)
+    def Process_GL2Test(self, test, filename, outname):
+        Log("GL2Test Not implemented:  %s" % filename)
+        self.CopyShaders(test, filename, outname)
 
-  def Process_uniformquery(self, test, filename, outname):
-    Log("uniformquery Not implemented:  %s" % filename)
-    self.CopyShaders(test, filename, outname)
+    def Process_uniformquery(self, test, filename, outname):
+        Log("uniformquery Not implemented:  %s" % filename)
+        self.CopyShaders(test, filename, outname)
 
-  def Process_egl_image_external(self, test, filename, outname):
-    """no need for egl_image_external tests"""
-    self.CopyShaders(test, filename, outname)
+    def Process_egl_image_external(self, test, filename, outname):
+        """no need for egl_image_external tests"""
+        self.CopyShaders(test, filename, outname)
 
-  def Process_dismount(self, test, filename, outname):
-    Log("dismount Not implemented:  %s" % filename)
-    self.CopyShaders(test, filename, outname)
+    def Process_dismount(self, test, filename, outname):
+        Log("dismount Not implemented:  %s" % filename)
+        self.CopyShaders(test, filename, outname)
 
-  def Process_build(self, test, filename, outname):
-    """don't need build tests"""
-    valid_tags = [
-      ["shader", "compstat", "linkstat"],
-      ["vertshader", "fragshader"],
-    ]
-    CheckForUnknownTags(valid_tags, test)
+    def Process_build(self, test, filename, outname):
+        """don't need build tests"""
+        valid_tags = [
+          ["shader", "compstat", "linkstat"],
+          ["vertshader", "fragshader"],
+        ]
+        CheckForUnknownTags(valid_tags, test)
 
-    shader = test.getElementsByTagName("shader")
-    if not shader:
-      return None
-    vs = GetElementText(shader[0], "vertshader")
-    fs = GetElementText(shader[0], "fragshader")
-    if vs and vs != "empty":
-      CopyShader(vs, filename, outname)
-    if fs and fs != "empty":
-      CopyShader(fs, filename, outname)
-    data = {
-      "name": os.path.basename(outname),
-      "compstat": bool(GetBoolElement(test, "compstat")),
-      "linkstat": bool(GetBoolElement(test, "linkstat")),
-      "testProgram": {
-        "vertexShader": vs,
-        "fragmentShader": fs,
-      },
-    }
-    attach = test.getElementsByTagName("attach")
-    if len(attach) > 0:
-      data["attachError"] = GetElementText(attach[0], "attacherror")
-    return data
+        shader = test.getElementsByTagName("shader")
+        if not shader:
+            return None
+        vs = GetElementText(shader[0], "vertshader")
+        fs = GetElementText(shader[0], "fragshader")
+        if vs and vs != "empty":
+            CopyShader(vs, filename, outname)
+        if fs and fs != "empty":
+            CopyShader(fs, filename, outname)
+        data = {
+          "name": os.path.basename(outname),
+          "compstat": bool(GetBoolElement(test, "compstat")),
+          "linkstat": bool(GetBoolElement(test, "linkstat")),
+          "testProgram": {
+            "vertexShader": vs,
+            "fragmentShader": fs,
+          },
+        }
+        attach = test.getElementsByTagName("attach")
+        if len(attach) > 0:
+            data["attachError"] = GetElementText(attach[0], "attacherror")
+        return data
 
-  def Process_coverage(self, test, filename, outname):
-    Log("coverage Not implemented:  %s" % filename)
-    self.CopyShaders(test, filename, outname)
+    def Process_coverage(self, test, filename, outname):
+        Log("coverage Not implemented:  %s" % filename)
+        self.CopyShaders(test, filename, outname)
 
-  def Process_attributes(self, test, filename, outname):
-    Log("attributes Not implemented:  %s" % filename)
-    self.CopyShaders(test, filename, outname)
+    def Process_attributes(self, test, filename, outname):
+        Log("attributes Not implemented:  %s" % filename)
+        self.CopyShaders(test, filename, outname)
 
-  def Process_fixed(self, test, filename, outname):
-    """no need for fixed function tests"""
-    self.CopyShaders(test, filename, outname)
+    def Process_fixed(self, test, filename, outname):
+        """no need for fixed function tests"""
+        self.CopyShaders(test, filename, outname)
 
 
 def main(argv):
-  """This is the main function."""
-  global VERBOSE
+    """This is the main function."""
+    global VERBOSE
 
-  parser = OptionParser()
-  parser.add_option(
-      "-v", "--verbose", action="store_true",
-      help="prints more output.")
+    parser = OptionParser()
+    parser.add_option(
+        "-v", "--verbose", action="store_true",
+        help="prints more output.")
 
-  (options, args) = parser.parse_args(args=argv)
+    (options, args) = parser.parse_args(args=argv)
 
-  if len(args) < 1:
-    pass # fix me
+    if len(args) < 1:
+        pass  # fix me
 
-  os.chdir(os.path.dirname(__file__) or '.')
+    os.chdir(os.path.dirname(__file__) or '.')
 
-  VERBOSE = options.verbose
+    VERBOSE = options.verbose
 
-  filename = args[0]
-  test_reader = TestReader(filename)
-  test_reader.ReadTests(filename)
+    filename = args[0]
+    test_reader = TestReader(filename)
+    test_reader.ReadTests(filename)
 
 
 if __name__ == '__main__':
-  sys.exit(main(sys.argv[1:]))
+    sys.exit(main(sys.argv[1:]))
--- a/dom/canvas/test/webgl-conf/checkout/deqp/build.py
+++ b/dom/canvas/test/webgl-conf/checkout/deqp/build.py
@@ -24,18 +24,16 @@
 #
 
 # Author: Mobica LTD
 
 import sys
 import re
 import os
 import subprocess
-import threading
-from sys import stdout, stderr, argv
 
 # Running this script
 # 1. To rebuild all dependencies:
 # $ build.py deps