Bug 1622677 - Make dom/bindings flake8 compliant. r=sylvestre

Differential Revision: https://phabricator.services.mozilla.com/D160902
This commit is contained in:
Edward Thomas 2023-02-24 13:53:21 +00:00
Родитель d6f4361746
Коммит 90f5fa7210
76 изменённых файлов: 622 добавлений и 638 удалений

Просмотреть файл

@ -3,7 +3,11 @@ max-line-length = 99
exclude =
# These paths should be triaged and either fixed or moved to the list below.
devtools/shared,
dom/bindings,
dom/bindings/Codegen.py,
dom/bindings/parser/WebIDL.py,
dom/bindings/parser/tests/test_arraybuffer.py,
dom/bindings/parser/tests/test_securecontext_extended_attribute.py,
gfx/tests,
ipc/ipdl/ipdl,
layout/base/tests/marionette,
layout/reftests/border-image,

Просмотреть файл

@ -2606,7 +2606,6 @@ class PropertyDefiner:
)
prefableWithDisablersTemplate = " { &%s_disablers%d, &%s_specs[%d] }"
prefableWithoutDisablersTemplate = " { nullptr, &%s_specs[%d] }"
prefCacheTemplate = "&%s[%d].disablers->enabled"
def switchToCondition(condition, specs):
# Set up pointers to the new sets of specs inside prefableSpecs
@ -3091,7 +3090,7 @@ class AttrDefiner(PropertyDefiner):
raise TypeError(
"Can't handle lenient cross-origin "
"readable attribute %s.%s"
% (self.descriptor.name, attr.identifier.name)
% (descriptor.name, attr.identifier.name)
)
if descriptor.interface.hasDescendantWithCrossOriginMembers:
accessor = (
@ -10321,7 +10320,6 @@ class CGSetterCall(CGPerSignatureCall):
self.idlNode
)
elif attr.getExtendedAttribute("Cached"):
args = "self"
clearSlot = "%s(self);\n" % MakeClearCachedValueNativeName(self.idlNode)
# We have no return value
@ -11280,7 +11278,7 @@ class CGSpecializedSetter(CGAbstractStaticMethod):
"We don't support the setter of %s marked as "
"CrossOriginWritable because it takes a Gecko interface "
"as the value",
attr.identifier.name,
self.attr.identifier.name,
)
prototypeID, _ = PrototypeIDAndDepth(self.descriptor)
prefix = fill(
@ -14614,7 +14612,6 @@ class CGDOMJSProxyHandler_getOwnPropDescriptor(ClassMethod):
self.descriptor = descriptor
def getBody(self):
indexedGetter = self.descriptor.operations["IndexedGetter"]
indexedSetter = self.descriptor.operations["IndexedSetter"]
if self.descriptor.isMaybeCrossOriginObject():
@ -20058,12 +20055,6 @@ class CGJSImplClass(CGBindingImplClass):
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)
@ -24033,14 +24024,11 @@ class CGEventClass(CGBindingImplClass):
return retVal
def define(self):
hasJS = False
if any(
not (
for m in self.membersNeedingTrace:
if not (
m.type.isAny() or m.type.isObject() or m.type.isSpiderMonkeyInterface()
)
for m in self.membersNeedingTrace
):
raise TypeError("Unknown traceable member type %s" % m.type)
):
raise TypeError("Unknown traceable member type %s" % m.type)
if len(self.membersNeedingTrace) > 0:
dropJS = "mozilla::DropJSObjects(this);\n"

Просмотреть файл

@ -2,14 +2,14 @@
# 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 WebIDL import IDLIncludesStatement
import io
import itertools
import os
import six
from collections import defaultdict
import six
from WebIDL import IDLIncludesStatement
autogenerated_comment = "/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n"

Просмотреть файл

@ -2,10 +2,10 @@
# 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 sys
import string
import argparse
import runpy
import string
import sys
# Generates a line of WebIDL with the given spelling of the property name
# (whether camelCase, _underscorePrefixed, etc.) and the given array of

Просмотреть файл

@ -5,11 +5,7 @@
import os
import sys
from mach.decorators import (
CommandArgument,
Command,
)
from mach.decorators import Command, CommandArgument
from mozbuild.util import mkdir

Просмотреть файл

@ -11,19 +11,15 @@ import io
import json
import logging
import os
import six
from copy import deepcopy
import mozpack.path as mozpath
import six
from mach.mixin.logging import LoggingMixin
from mozbuild.makeutil import Makefile
from mozbuild.pythonutil import iter_modules_in_path
from mozbuild.util import FileAvoidWrite
import mozpack.path as mozpath
import buildconfig
# There are various imports in this file in functions to avoid adding
# dependencies to config.status. See bug 949875.
@ -563,10 +559,7 @@ class WebIDLCodegenManager(LoggingMixin):
return paths
def _generate_build_files_for_webidl(self, filename):
from Codegen import (
CGBindingRoot,
CGEventRoot,
)
from Codegen import CGBindingRoot, CGEventRoot
self.log(
logging.INFO,

Просмотреть файл

@ -12,19 +12,9 @@ import tempfile
import unittest
import mozpack.path as mozpath
from mozwebidlcodegen import (
WebIDLCodegenManager,
WebIDLCodegenManagerState,
)
from mozfile import NamedTemporaryFile
from mozunit import (
MockedOpen,
main,
)
from mozunit import MockedOpen, main
from mozwebidlcodegen import WebIDLCodegenManager, WebIDLCodegenManagerState
OUR_DIR = mozpath.abspath(mozpath.dirname(__file__))
TOPSRCDIR = mozpath.normpath(mozpath.join(OUR_DIR, "..", "..", "..", ".."))

Просмотреть файл

@ -453,7 +453,7 @@ class IDLIdentifierPlaceholder(IDLObjectWithIdentifier):
def finish(self, scope):
try:
scope._lookupIdentifier(self.identifier)
except:
except Exception:
raise WebIDLError(
"Unresolved type '%s'." % self.identifier, [self.location]
)
@ -996,7 +996,7 @@ class IDLInterfaceOrNamespace(IDLInterfaceOrInterfaceMixinOrNamespace):
)
try:
return self._lookupIdentifier(identifier)
except:
except Exception:
return None
def isIterable(self):
@ -1827,7 +1827,7 @@ class IDLInterfaceOrNamespace(IDLInterfaceOrInterfaceMixinOrNamespace):
def isExposedConditionally(self, exclusions=[]):
return any(
((not a in exclusions) and self.getExtendedAttribute(a))
((a not in exclusions) and self.getExtendedAttribute(a))
for a in self.conditionExtendedAttributes
)
@ -1885,14 +1885,15 @@ class IDLInterface(IDLInterfaceOrNamespace):
elif identifier == "LegacyFactoryFunction":
if not attr.hasValue():
raise WebIDLError(
"LegacyFactoryFunction must either take an identifier or take a named argument list",
(
"LegacyFactoryFunction must either take an "
"identifier or take a named argument list"
),
[attr.location],
)
args = attr.args() if attr.hasArgs() else []
retType = IDLWrapperType(self.location, self)
method = IDLConstructor(attr.location, args, attr.value())
method.reallyInit(self)
@ -2620,7 +2621,7 @@ class IDLUnresolvedType(IDLType):
obj = None
try:
obj = scope._lookupIdentifier(self.name)
except:
except Exception:
raise WebIDLError("Unresolved type '%s'." % self.name, [self.location])
assert obj
@ -2636,7 +2637,6 @@ class IDLUnresolvedType(IDLType):
assert self.name.name == obj.identifier.name
return IDLCallbackType(self.location, obj)
name = self.name.resolve(scope, None)
return IDLWrapperType(self.location, obj)
def withExtendedAttributes(self, attrs):
@ -3164,7 +3164,8 @@ class IDLUnionType(IDLType):
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]))
@ -3671,9 +3672,9 @@ class IDLBuiltinType(IDLType):
attrLocation=[],
):
"""
The mutually exclusive clamp/enforceRange/legacyNullToEmptyString/allowShared arguments are used
to create instances of this type with the appropriate attributes attached. Use .clamped(),
.rangeEnforced(), .withLegacyNullToEmptyString() and .withAllowShared().
The mutually exclusive clamp/enforceRange/legacyNullToEmptyString/allowShared arguments
are used to create instances of this type with the appropriate attributes attached. Use
.clamped(), .rangeEnforced(), .withLegacyNullToEmptyString() and .withAllowShared().
attrLocation is an array of source locations of these attributes for error reporting.
"""
@ -4330,7 +4331,7 @@ class IDLEmptySequenceValue(IDLObject):
for subtype in type.unroll().flatMemberTypes:
try:
return self.coerceToType(subtype, location)
except:
except Exception:
pass
if not type.isSequence():
@ -4360,7 +4361,7 @@ class IDLDefaultDictionaryValue(IDLObject):
for subtype in type.unroll().flatMemberTypes:
try:
return self.coerceToType(subtype, location)
except:
except Exception:
pass
if not type.isDictionary():
@ -4505,7 +4506,7 @@ class IDLInterfaceMember(IDLObjectWithIdentifier, IDLExposureMixins):
)
if affects not in IDLInterfaceMember.AffectsValues:
raise WebIDLError(
"Invalid [Affects=%s] on attribute" % dependsOn, [self.location]
"Invalid [Affects=%s] on attribute" % affects, [self.location]
)
self.affects = affects
@ -5097,7 +5098,7 @@ class IDLConst(IDLInterfaceMember):
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
@ -5725,7 +5726,7 @@ class IDLAttribute(IDLInterfaceMember):
method.addExtendedAttributes(
[IDLExtendedAttribute(self.location, (key,))]
)
elif not key in attributeOnlyExtAttrs:
elif key not in attributeOnlyExtAttrs:
raise WebIDLError(
"[%s] is currently unsupported in "
"stringifier attributes, please file a bug "
@ -6252,8 +6253,10 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
if self.isLegacycaller() != method.isLegacycaller():
raise WebIDLError(
"Overloaded identifier %s appears with different values of the 'legacycaller' attribute"
% method.identifier,
(
"Overloaded identifier %s appears with different "
"values of the 'legacycaller' attribute" % method.identifier
),
[method.location],
)
@ -6856,7 +6859,7 @@ class Tokenizer(object):
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",
[
@ -8545,7 +8548,7 @@ class Parser(Tokenizer):
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])
@ -8808,7 +8811,10 @@ class Parser(Tokenizer):
def p_error(self, p):
if not p:
raise WebIDLError(
"Syntax Error at end of file. Possibly due to missing semicolon(;), braces(}) or both",
(
"Syntax Error at end of file. Possibly due to "
"missing semicolon(;), braces(}) or both"
),
[self._filename],
)
else:
@ -8856,9 +8862,7 @@ class Parser(Tokenizer):
):
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):

Просмотреть файл

@ -1,11 +1,15 @@
# 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 argparse
import glob
import os
import sys
import glob
import argparse
import traceback
import WebIDL
@ -58,7 +62,7 @@ class TestHarness(object):
try:
parser.parse(code)
parser.finish()
except:
except Exception:
threw = True
self.ok(threw, "Should have thrown: %s" % msg)

Просмотреть файл

@ -9,8 +9,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -9,8 +9,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -0,0 +1,16 @@
def WebIDLTest(parser, harness):
threw = False
try:
parser.parse(
"""
interface VoidArgument1 {
void foo(void arg2);
};
"""
)
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -147,7 +147,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should not allow [SetterThrows] on readonly attributes")
@ -162,7 +162,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should spell [Throws] correctly")
@ -177,7 +177,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(
threw, "Should not allow [SameObject] on attributes not of interface type"
@ -194,6 +194,6 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(not threw, "Should allow [SameObject] on attributes of interface type")

Просмотреть файл

@ -9,8 +9,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Attribute type must not be a sequence type")
@ -27,8 +27,8 @@ def WebIDLTest(parser, harness):
"""
)
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")
@ -45,8 +45,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -59,15 +59,15 @@ def WebIDLTest(parser, harness):
threw = False
try:
parser.parse(
"""
interface AttrUnionWithUnionWithSequenceType {
attribute ((sequence<object> or DOMString) or AttrUnionWithUnionWithSequenceType) foo;
};
"""
"\n"
" interface AttrUnionWithUnionWithSequenceType {\n"
" attribute ((sequence<object> or DOMString) or "
"AttrUnionWithUnionWithSequenceType) foo;\n"
" };\n"
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(

Просмотреть файл

@ -1,7 +1,3 @@
# Import the WebIDL module, so we can do isinstance checks and whatnot
import WebIDL
def WebIDLTest(parser, harness):
# Basic functionality
threw = False
@ -46,7 +42,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(not threw, "Should not have thrown on parsing normal")
@ -182,7 +178,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(not threw, "Should not have thrown on parsing normal")
@ -347,7 +343,7 @@ def WebIDLTest(parser, harness):
try:
parser.parse(template % ("", "long"))
parser.finish()
except:
except Exception:
threw = True
harness.ok(not threw, "Template for %s parses without attributes" % name)
for (attribute, type) in ATTRIBUTES:
@ -356,7 +352,7 @@ def WebIDLTest(parser, harness):
try:
parser.parse(template % (attribute, type))
parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow %s on %s" % (attribute, name))
@ -369,7 +365,7 @@ def WebIDLTest(parser, harness):
"""
)
parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow mixing [Clamp] and [EnforceRange]")
@ -383,7 +379,7 @@ def WebIDLTest(parser, harness):
"""
)
parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow mixing [Clamp] and [EnforceRange]")
@ -398,7 +394,7 @@ def WebIDLTest(parser, harness):
"""
)
parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow mixing [Clamp] and [EnforceRange] via typedefs")
@ -413,7 +409,7 @@ def WebIDLTest(parser, harness):
"""
)
parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow mixing [Clamp] and [EnforceRange] via typedefs")
@ -437,7 +433,7 @@ def WebIDLTest(parser, harness):
% type
)
parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow [Clamp] on %s" % type)
@ -452,7 +448,7 @@ def WebIDLTest(parser, harness):
% type
)
parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow [EnforceRange] on %s" % type)
@ -466,7 +462,7 @@ def WebIDLTest(parser, harness):
"""
)
parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow [LegacyNullToEmptyString] on long")
@ -480,7 +476,7 @@ def WebIDLTest(parser, harness):
"""
)
parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow [LegacyNullToEmptyString] on JSString")
@ -494,7 +490,7 @@ def WebIDLTest(parser, harness):
"""
)
parser.finish()
except:
except Exception:
threw = True
harness.ok(
@ -510,7 +506,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "[AllowShared] only allowed on buffer source types")
@ -523,7 +519,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "[AllowShared] must take no arguments")
@ -539,7 +535,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(not threw, "Should allow type attributes on unresolved types")
harness.check(
@ -560,11 +556,12 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(not threw, "Should allow type attributes on typedefs")
harness.check(
results[0].members[0].signatures()[0][1][0].type.hasClamp(),
True,
"Unresolved types that resolve to typedefs with attributes should correctly resolve with attributes",
"Unresolved types that resolve to typedefs with attributes should correctly resolve with "
"attributes",
)

Просмотреть файл

@ -1,6 +1,3 @@
import WebIDL
def WebIDLTest(parser, harness):
parser.parse(
"""

Просмотреть файл

@ -79,7 +79,7 @@ def WebIDLTest(parser, harness):
};
"""
)
results2 = parser.finish()
parser.finish()
except WebIDL.WebIDLError as e:
harness.ok(
False,
@ -96,7 +96,7 @@ def WebIDLTest(parser, harness):
};
"""
)
results3 = parser.finish()
parser.finish()
except WebIDL.WebIDLError as e:
harness.ok(
False,
@ -114,8 +114,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results4 = parser.finish()
except WebIDL.WebIDLError as e:
parser.finish()
except WebIDL.WebIDLError:
threw = True
harness.ok(

Просмотреть файл

@ -59,7 +59,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
@ -76,7 +76,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(

Просмотреть файл

@ -1,6 +1,3 @@
import WebIDL
def WebIDLTest(parser, harness):
parser.parse(
"""
@ -28,8 +25,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should not allow non-callback parent of callback interface")
@ -46,8 +43,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should not allow callback parent of non-callback interface")

Просмотреть файл

@ -9,8 +9,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown for [CEReactions] with an argument")
@ -26,8 +26,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown for [CEReactions] with an argument")
@ -43,7 +43,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
parser.finish()
except Exception as e:
harness.ok(
False,
@ -63,7 +63,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
parser.finish()
except Exception as e:
harness.ok(
False,
@ -83,8 +83,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -102,8 +102,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown for [CEReactions] used on a interface")
@ -118,8 +118,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown for [CEReactions] used on a named getter")
@ -134,8 +134,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown for [CEReactions] used on a legacycaller")
@ -150,8 +150,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown for [CEReactions] used on a stringifier")

Просмотреть файл

@ -91,6 +91,6 @@ def WebIDLTest(parser, harness):
"""
)
parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Nullable types are not allowed for consts.")

Просмотреть файл

@ -282,12 +282,14 @@ def WebIDLTest(parser, harness):
parser = parser.reset()
parser.parse(
"""
interface TestPrefChromeOnlySCFuncConstructor {
[ChromeOnly, Pref="dom.webidl.test1", SecureContext, Func="Document::IsWebAnimationsEnabled"]
constructor();
};
"""
(
"\n"
" interface TestPrefChromeOnlySCFuncConstructor {\n"
' [ChromeOnly, Pref="dom.webidl.test1", SecureContext, '
'Func="Document::IsWebAnimationsEnabled"]\n'
" constructor();\n"
" };\n"
)
)
results = parser.finish()
harness.check(len(results), 1, "Should be one production")
@ -336,7 +338,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Can't have both a constructor and a ChromeOnly constructor")
@ -353,7 +355,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "HTMLConstructor should take no argument")
@ -370,7 +372,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "HTMLConstructor can't be used on a callback interface")
@ -388,7 +390,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Can't have both a constructor and a HTMLConstructor")
@ -406,7 +408,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Can't have both a throwing constructor and a HTMLConstructor")
@ -423,7 +425,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Can't have both a HTMLConstructor and a constructor operation")
@ -441,7 +443,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
@ -463,7 +465,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Can't have both a ChromeOnly constructor and a HTMLConstructor")
@ -481,7 +483,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
@ -502,7 +504,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
@ -523,7 +525,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
@ -544,7 +546,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
@ -567,7 +569,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Can't have a constructor operation on a partial interface")
@ -588,7 +590,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Can't have a constructor operation on a mixin")

Просмотреть файл

@ -1,6 +1,3 @@
import traceback
def WebIDLTest(parser, harness):
threw = False
try:
@ -13,8 +10,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -30,8 +27,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -47,8 +44,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -65,8 +62,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -10,8 +10,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -40,8 +40,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -1,6 +1,3 @@
import WebIDL
def WebIDLTest(parser, harness):
parser.parse(
"""

Просмотреть файл

@ -67,8 +67,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should not allow name duplication in a dictionary")
@ -87,8 +87,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -112,8 +112,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -132,8 +132,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should not allow non-dictionary parents for dictionaries")
@ -148,8 +148,8 @@ def WebIDLTest(parser, harness):
dictionary B : A {};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should not allow cycles in dictionary inheritance chains")
@ -164,8 +164,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -184,8 +184,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Trailing dictionary arg must be optional")
@ -202,8 +202,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Trailing dictionary arg must have a default value")
@ -220,8 +220,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Trailing union arg containing a dictionary must be optional")
@ -238,8 +238,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -258,8 +258,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Dictionary arg followed by optional arg must be optional")
@ -276,8 +276,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Dictionary arg followed by optional arg must have default value")
@ -294,8 +294,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -315,8 +315,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -336,8 +336,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -356,7 +356,7 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
parser.finish()
harness.ok(True, "Dictionary arg followed by required arg can be required")
parser = parser.reset()
@ -371,7 +371,7 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
parser.finish()
except Exception as x:
threw = x
@ -394,7 +394,7 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
parser.finish()
except Exception as x:
threw = x
@ -416,7 +416,7 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
parser.finish()
except Exception as x:
threw = x
@ -440,7 +440,7 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
parser.finish()
except Exception as x:
threw = x
@ -463,8 +463,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(not threw, "Nullable union should be allowed in a sequence argument")
@ -481,8 +481,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Dictionary must not be in a union with a nullable type")
@ -498,8 +498,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "A nullable type must not be in a union with a dictionary")
@ -513,7 +513,7 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
parser.finish()
harness.ok(True, "Dictionary return value can be nullable")
parser = parser.reset()
@ -526,7 +526,7 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
parser.finish()
harness.ok(True, "Dictionary arg should actually parse")
parser = parser.reset()
@ -539,7 +539,7 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
parser.finish()
harness.ok(True, "Union arg containing a dictionary should actually parse")
parser = parser.reset()
@ -552,7 +552,7 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
parser.finish()
harness.ok(
True,
"Union arg containing a dictionary with string default should actually parse",
@ -568,8 +568,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Member type must not be its Dictionary.")
@ -596,8 +596,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -615,8 +615,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -635,8 +635,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -655,8 +655,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -675,8 +675,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -707,8 +707,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -731,8 +731,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Member type must not be a nullable dictionary")
@ -759,7 +759,7 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
parser.finish()
harness.ok(True, "Parsing default values for unrestricted types succeeded.")
parser = parser.reset()
@ -772,8 +772,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Only unrestricted values can be initialized to Infinity")
@ -788,8 +788,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Only unrestricted values can be initialized to -Infinity")
@ -804,8 +804,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Only unrestricted values can be initialized to NaN")
@ -820,8 +820,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Only unrestricted values can be initialized to Infinity")
@ -836,8 +836,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Only unrestricted values can be initialized to -Infinity")
@ -852,8 +852,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Only unrestricted values can be initialized to NaN")
@ -868,8 +868,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(not threw, "Should be able to use 'module' as a dictionary member name")

Просмотреть файл

@ -1,6 +1,3 @@
import traceback
def firstArgType(method):
return method.signatures()[0][1][0].type
@ -143,8 +140,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -167,8 +164,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should throw when there is no distinguishing index")
@ -246,7 +243,6 @@ def WebIDLTest(parser, harness):
]
nonStrings = allBut(argTypes, strings)
nonObjects = undefineds + primitives + strings
objects = allBut(argTypes, nonObjects)
bufferSourceTypes = ["ArrayBuffer", "ArrayBufferView", "Uint8Array", "Uint16Array"]
interfaces = [
"Interface",
@ -401,8 +397,8 @@ def WebIDLTest(parser, harness):
threw = False
try:
parser.parse(idl)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
if areDistinguishable(type1, type2):

Просмотреть файл

@ -9,8 +9,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -9,8 +9,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -25,8 +25,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -41,8 +41,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -57,8 +57,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -1,6 +1,3 @@
import WebIDL
def WebIDLTest(parser, harness):
try:
parser.parse(
@ -11,7 +8,7 @@ def WebIDLTest(parser, harness):
)
harness.ok(False, "Should have thrown!")
except:
except Exception:
harness.ok(True, "Parsing TestEmptyEnum enum should fail")
results = parser.finish()
parser.finish()

Просмотреть файл

@ -13,7 +13,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Constant cannot have [] as a default value")

Просмотреть файл

@ -86,8 +86,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should not allow a bogus default value for an enum")

Просмотреть файл

@ -1,6 +1,3 @@
import WebIDL
def WebIDLTest(parser, harness):
try:
parser.parse(
@ -12,5 +9,5 @@ def WebIDLTest(parser, harness):
"""
)
harness.ok(False, "Should have thrown!")
except:
except Exception:
harness.ok(True, "Enum TestEnumDuplicateValue should throw")

Просмотреть файл

@ -8,7 +8,7 @@ def WebIDLTest(parser, harness):
input = "interface ?"
try:
parser.parse(input)
results = parser.finish()
parser.finish()
except WebIDL.WebIDLError as e:
threw = True
lines = str(e).split("\n")

Просмотреть файл

@ -14,7 +14,7 @@ interface Foo {
interface ?"""
try:
parser.parse(input)
results = parser.finish()
parser.finish()
except WebIDL.WebIDLError as e:
threw = True
lines = str(e).split("\n")

Просмотреть файл

@ -162,7 +162,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown on invalid Exposed value on interface.")
@ -180,7 +180,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown on invalid Exposed value on attribute.")
@ -198,7 +198,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown on invalid Exposed value on operation.")
@ -216,7 +216,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown on invalid Exposed value on constant.")
@ -238,7 +238,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(
@ -354,7 +354,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(
@ -377,7 +377,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown on a wildcard in an identifier list.")

Просмотреть файл

@ -1,6 +1,3 @@
import WebIDL
def WebIDLTest(parser, harness):
parser.parse(
"""
@ -11,7 +8,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
parser.finish()
parser = parser.reset()
parser.parse(
@ -23,7 +20,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
parser.finish()
parser = parser.reset()
parser.parse(
@ -49,8 +46,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "[LegacyLenientThis] must take no arguments")
@ -86,8 +83,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "[Clamp] must take no arguments")
@ -124,8 +121,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "[EnforceRange] must take no arguments")

Просмотреть файл

@ -74,7 +74,7 @@ def WebIDLTest(parser, harness):
};
"""
)
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "[LenientFloat] only allowed on methods returning undefined")
@ -89,7 +89,7 @@ def WebIDLTest(parser, harness):
};
"""
)
except Exception as x:
except Exception:
threw = True
harness.ok(
threw, "[LenientFloat] only allowed on methods with unrestricted float args"
@ -106,7 +106,7 @@ def WebIDLTest(parser, harness):
};
"""
)
except Exception as x:
except Exception:
threw = True
harness.ok(
threw, "[LenientFloat] only allowed on methods with unrestricted float args (2)"
@ -123,7 +123,7 @@ def WebIDLTest(parser, harness):
};
"""
)
except Exception as x:
except Exception:
threw = True
harness.ok(
threw, "[LenientFloat] only allowed on methods with unrestricted float args (3)"
@ -140,6 +140,6 @@ def WebIDLTest(parser, harness):
};
"""
)
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "[LenientFloat] only allowed on writable attributes")

Просмотреть файл

@ -1,6 +1,3 @@
import WebIDL
def WebIDLTest(parser, harness):
parser.parse(
"""
@ -13,6 +10,6 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
parser.finish()
harness.ok(True, "TestForwardDeclared interface parsed without error.")

Просмотреть файл

@ -33,8 +33,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -54,8 +54,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -73,8 +73,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -96,8 +96,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -119,8 +119,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(

Просмотреть файл

@ -1,7 +1,3 @@
# Import the WebIDL module, so we can do isinstance checks and whatnot
import WebIDL
def WebIDLTest(parser, harness):
try:
parser.parse(
@ -10,7 +6,7 @@ def WebIDLTest(parser, harness):
interface Foo;
"""
)
results = parser.finish()
parser.finish()
harness.ok(False, "Should fail to parse")
except Exception as e:
harness.ok(
@ -25,7 +21,7 @@ def WebIDLTest(parser, harness):
enum Foo { "a" };
"""
)
results = parser.finish()
parser.finish()
harness.ok(False, "Should fail to parse")
except Exception as e:
harness.ok(
@ -40,7 +36,7 @@ def WebIDLTest(parser, harness):
enum Foo { "b" };
"""
)
results = parser.finish()
parser.finish()
harness.ok(False, "Should fail to parse")
except Exception as e:
harness.ok(

Просмотреть файл

@ -1,6 +1,3 @@
import WebIDL
def WebIDLTest(parser, harness):
parser.parse(
"""

Просмотреть файл

@ -70,7 +70,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow cycles in interface inheritance chains")
@ -86,7 +86,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
@ -103,7 +103,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
@ -223,7 +223,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow two non-partial interfaces with the same name")
@ -241,7 +241,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Must have a non-partial interface for a given name")
@ -259,7 +259,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw,
@ -281,7 +281,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw, "Should not allow a name collision between interface " "and other object"
@ -299,7 +299,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw,
@ -319,7 +319,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw,
@ -351,7 +351,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow unknown extended attributes on interfaces")
@ -383,7 +383,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow [LegacyWindowAlias] with no value")
@ -397,7 +397,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow [LegacyWindowAlias] without Window exposure")
@ -414,7 +414,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw, "Should not allow [LegacyWindowAlias] to conflict with other identifiers"
@ -433,7 +433,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw, "Should not allow [LegacyWindowAlias] to conflict with other identifiers"
@ -452,7 +452,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw, "Should not allow [LegacyWindowAlias] to conflict with other identifiers"

Просмотреть файл

@ -10,8 +10,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -10,8 +10,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -27,8 +27,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -44,8 +44,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -61,8 +61,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -1,5 +1,4 @@
import WebIDL
import traceback
def WebIDLTest(parser, harness):
@ -45,7 +44,7 @@ def WebIDLTest(parser, harness):
p.parse(iface)
p.finish()
harness.ok(False, prefix + " - Interface passed when should've failed")
except WebIDL.WebIDLError as e:
except WebIDL.WebIDLError:
harness.ok(True, prefix + " - Interface failed as expected")
except Exception as e:
harness.ok(
@ -66,12 +65,6 @@ def WebIDLTest(parser, harness):
setRWMembers = [
(x, WebIDL.IDLMethod) for x in ["add", "clear", "delete"]
] + setROMembers
setROChromeMembers = [
(x, WebIDL.IDLMethod) for x in ["__add", "__clear", "__delete"]
] + setROMembers
setRWChromeMembers = [
(x, WebIDL.IDLMethod) for x in ["__add", "__clear", "__delete"]
] + setRWMembers
mapROMembers = (
[(x, WebIDL.IDLMethod) for x in ["get", "has"]]
+ [("__maplike", WebIDL.IDLMaplikeOrSetlike)]
@ -81,9 +74,6 @@ def WebIDLTest(parser, harness):
mapRWMembers = [
(x, WebIDL.IDLMethod) for x in ["set", "clear", "delete"]
] + mapROMembers
mapRWChromeMembers = [
(x, WebIDL.IDLMethod) for x in ["__set", "__clear", "__delete"]
] + mapRWMembers
# OK, now that we've used iterableMembers to set up the above, append
# __iterable to it for the iterable<> case.

Просмотреть файл

@ -155,7 +155,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw, "Should not allow two non-partial interface mixins with the same name"
@ -175,7 +175,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Must have a non-partial interface mixin for a given name")
@ -193,7 +193,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw,
@ -215,7 +215,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw,
@ -234,7 +234,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw,
@ -254,7 +254,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw, "Should not allow unknown extended attributes on interface mixins"
@ -271,7 +271,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow getters on interface mixins")
@ -286,7 +286,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow setters on interface mixins")
@ -301,7 +301,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow deleters on interface mixins")
@ -316,7 +316,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow legacycallers on interface mixins")
@ -331,7 +331,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow inherited attribute on interface mixins")
@ -348,7 +348,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should fail if the right side does not point an interface mixin")
@ -365,7 +365,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should fail if the left side does not point an interface")
@ -380,7 +380,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should fail if an interface mixin includes iterable")
@ -395,7 +395,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should fail if an interface mixin includes setlike")
@ -410,7 +410,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should fail if an interface mixin includes maplike")
@ -429,7 +429,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw, "Should fail if the included mixin interface has duplicated member"
@ -452,7 +452,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw, "Should fail if the included mixin interfaces have duplicated member"

Просмотреть файл

@ -9,7 +9,7 @@ def should_throw(parser, harness, message, code):
try:
parser.parse(code)
parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should have thrown: %s" % message)

Просмотреть файл

@ -267,7 +267,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(not threw, "Should allow integer to float type corecion")
@ -282,7 +282,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should not allow [GetterThrows] on methods")
@ -297,7 +297,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should not allow [SetterThrows] on methods")
@ -312,7 +312,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should spell [Throws] correctly on methods")
@ -327,7 +327,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should not allow __noSuchMethod__ methods")
@ -345,7 +345,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(not threw, "Should allow LenientFloat to be only in a specific overload")
@ -383,7 +383,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(
threw,
@ -404,7 +404,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(
threw,
@ -425,6 +425,6 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should prevent overloads from getting redundant [LenientFloat]")

Просмотреть файл

@ -71,7 +71,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -87,7 +87,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -107,7 +107,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -127,7 +127,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -147,7 +147,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -167,7 +167,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -187,7 +187,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -207,7 +207,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -227,6 +227,6 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -1,7 +1,4 @@
# Import the WebIDL module, so we can do isinstance checks and whatnot
import WebIDL
def WebIDLTest(parser, harness):
# Basic functionality
parser.parse(
@ -25,8 +22,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "[NewObject] attributes must depend on something")
@ -40,8 +37,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "[NewObject] methods must depend on something")
@ -55,8 +52,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "[NewObject] attributes must not be [Cached]")
@ -70,7 +67,7 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "[NewObject] attributes must not be [StoreInSlot]")

Просмотреть файл

@ -1,6 +1,3 @@
import WebIDL
def WebIDLTest(parser, harness):
parser.parse(
"""
@ -105,13 +102,13 @@ def checkEquivalent(iface, harness):
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),
@ -131,7 +128,7 @@ def checkEquivalent(iface, harness):
else:
try:
a2 = getattr(type2, attr)
except:
except Exception:
harness.ok(
False,
"Missing %s attribute on type %s in %s" % (attr, type2, iface),

Просмотреть файл

@ -0,0 +1,16 @@
def WebIDLTest(parser, harness):
threw = False
try:
parser.parse(
"""
interface NullableVoid {
void? foo();
};
"""
)
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -9,8 +9,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(

Просмотреть файл

@ -8,9 +8,9 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow Promise return values for legacycaller.")
@ -25,8 +25,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
threw,
@ -45,8 +45,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
threw,
@ -64,8 +64,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should not allow nullable Promise return values.")
@ -79,8 +79,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should not allow nullable Promise arguments.")
@ -93,7 +93,7 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
parser.finish()
harness.ok(
True, "Should allow overloads which only have Promise and return " "types."
@ -109,8 +109,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should not allow writable Promise-typed attributes.")
@ -124,8 +124,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
threw, "Should not allow [LegacyLenientSetter] Promise-typed attributes."
@ -141,8 +141,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should not allow [PutForwards] Promise-typed attributes.")
@ -156,8 +156,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should not allow [Replaceable] Promise-typed attributes.")
@ -171,7 +171,7 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should not allow [SameObject] Promise-typed attributes.")

Просмотреть файл

@ -8,8 +8,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "The identifier of a static attribute must not be 'prototype'")
@ -24,8 +24,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "The identifier of a static operation must not be 'prototype'")
@ -40,8 +40,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "The identifier of a constant must not be 'prototype'")

Просмотреть файл

@ -9,8 +9,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -28,8 +28,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -48,8 +48,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -68,8 +68,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -88,8 +88,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -112,8 +112,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -38,7 +38,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(
threw, "Should have thrown because record can't have undefined as value type."
@ -56,6 +56,6 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown on dictionary containing itself via record.")

Просмотреть файл

@ -9,7 +9,7 @@ def should_throw(parser, harness, message, code):
try:
parser.parse(code)
parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should have thrown: %s" % message)

Просмотреть файл

@ -1,6 +1,3 @@
import WebIDL
def WebIDLTest(parser, harness):
parser.parse(
"""
@ -41,11 +38,17 @@ def WebIDLTest(parser, harness):
)
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"
),
)
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"
),
)
harness.ok(
results[0].members[5].getExtendedAttribute("SecureContext"),
@ -93,15 +96,24 @@ def WebIDLTest(parser, harness):
)
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"
),
)
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"
),
)
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"
),
)
parser = parser.reset()
@ -132,15 +144,24 @@ def WebIDLTest(parser, harness):
)
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"
),
)
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"
),
)
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"
),
)
harness.ok(
results[0].members[3].getExtendedAttribute("SecureContext"),
@ -297,7 +318,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "[SecureContext] must take no arguments (testing on interface)")
@ -316,11 +337,14 @@ def WebIDLTest(parser, harness):
"""
)
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",
(
"If [SecureContext] appears on an overloaded operation, then it MUST appear on all "
"overloads"
),
)
parser = parser.reset()
@ -339,7 +363,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
not threw,
@ -359,7 +383,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw, "[SecureContext] must not appear on an interface and interface member"
@ -380,11 +404,14 @@ def WebIDLTest(parser, harness):
"""
)
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",
(
"[SecureContext] must not appear on a partial interface and one of the partial "
"interface's member's"
),
)
parser = parser.reset()
@ -402,11 +429,14 @@ def WebIDLTest(parser, harness):
"""
)
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",
(
"[SecureContext] must not appear on an interface and one of its partial interface's "
"member's"
),
)
parser = parser.reset()
@ -423,11 +453,14 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw,
"[SecureContext] must appear on interfaces that inherit from another [SecureContext] interface",
(
"[SecureContext] must appear on interfaces that inherit from another [SecureContext] "
"interface"
),
)
# Test 'includes'.
@ -450,7 +483,10 @@ def WebIDLTest(parser, harness):
harness.check(
len(results[0].members),
4,
"TestSecureContextInterfaceThatImplementsNonSecureContextInterface should have four members",
(
"TestSecureContextInterfaceThatImplementsNonSecureContextInterface should have four "
"members"
),
)
harness.ok(
results[0].getExtendedAttribute("SecureContext"),
@ -458,7 +494,10 @@ def WebIDLTest(parser, harness):
)
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"
),
)
harness.ok(
results[0].members[1].getExtendedAttribute("SecureContext") is None,

Просмотреть файл

@ -9,8 +9,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -25,8 +25,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -41,8 +41,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -57,8 +57,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -73,8 +73,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -89,8 +89,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -105,8 +105,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -121,8 +121,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -137,8 +137,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -153,8 +153,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -169,8 +169,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -185,8 +185,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -201,8 +201,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -217,8 +217,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -233,8 +233,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -249,8 +249,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -111,7 +111,7 @@ def WebIDLTest(parser, harness):
"""
)
parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "There are no indexed deleters")

Просмотреть файл

@ -1,6 +1,3 @@
import WebIDL
def WebIDLTest(parser, harness):
threw = False
try:
@ -13,8 +10,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -30,8 +27,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -47,8 +44,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -30,7 +30,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow two 'stringifier;'")
@ -48,7 +48,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow a 'stringifier;' and a 'stringifier()'")
@ -156,7 +156,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow ByteString")
@ -173,7 +173,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow a 'stringifier;' and a stringifier attribute")
@ -190,7 +190,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should not allow multiple stringifier attributes")

Просмотреть файл

@ -8,8 +8,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(not threw, "Should allow a toJSON method.")
@ -24,8 +24,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should not allow overloads of a toJSON method.")
@ -39,8 +39,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should not allow a toJSON method with arguments.")
@ -54,8 +54,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(not threw, "Should allow a toJSON method with 'long' as return type.")
@ -69,8 +69,8 @@ def WebIDLTest(parser, harness):
};
"""
)
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."
@ -86,8 +86,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
threw,

Просмотреть файл

@ -1,6 +1,3 @@
import WebIDL
def WebIDLTest(parser, harness):
parser.parse(
"""
@ -36,7 +33,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -57,7 +54,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -74,7 +71,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -32,7 +32,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should have thrown on nullable inside nullable arg.")
@ -49,7 +49,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should have thrown on nullable inside nullable const.")
@ -66,7 +66,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(

Просмотреть файл

@ -8,7 +8,7 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
parser.finish()
except Exception as e:
exception = e

Просмотреть файл

@ -1,6 +1,3 @@
import WebIDL
def WebIDLTest(parser, harness):
try:
parser.parse(
@ -11,8 +8,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "undefined must not be used as the type of a dictionary member")
@ -28,8 +25,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -49,8 +46,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -70,8 +67,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -91,8 +88,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -112,8 +109,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -133,8 +130,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -152,8 +149,8 @@ def WebIDLTest(parser, harness):
callback Callback = undefined (undefined foo);
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -173,8 +170,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -195,8 +192,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -216,8 +213,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -236,8 +233,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(

Просмотреть файл

@ -27,7 +27,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -44,7 +44,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")
@ -66,6 +66,6 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -95,7 +95,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw,
@ -118,7 +118,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
threw,
@ -141,7 +141,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(
threw,
@ -164,7 +164,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except Exception as x:
except Exception:
threw = True
harness.ok(
threw,
@ -210,7 +210,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
@ -240,7 +240,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
@ -270,7 +270,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(
@ -305,7 +305,7 @@ def WebIDLTest(parser, harness):
)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should have thrown for static [LegacyUnforgeable] attribute.")

Просмотреть файл

@ -1,5 +1,3 @@
import WebIDL
import itertools
import string
# We'd like to use itertools.chain but it's 2.6 or higher.
@ -190,7 +188,7 @@ def WebIDLTest(parser, harness):
try:
parser.parse(interface)
results = parser.finish()
except:
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -9,8 +9,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown.")

Просмотреть файл

@ -9,8 +9,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Two nullable member types of a union should have thrown.")
@ -27,8 +27,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -50,8 +50,8 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(

Просмотреть файл

@ -1,6 +1,3 @@
import WebIDL
def WebIDLTest(parser, harness):
parser.parse(
"""
@ -8,6 +5,6 @@ def WebIDLTest(parser, harness):
"""
)
results = parser.finish()
parser.finish()
harness.ok(True, "TestVariadicCallback callback parsed without error.")

Просмотреть файл

@ -8,9 +8,9 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
parser.finish()
except:
except Exception:
threw = True
harness.ok(
@ -28,8 +28,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(
@ -47,9 +47,9 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
parser.finish()
except:
except Exception:
threw = True
harness.ok(
@ -67,8 +67,8 @@ def WebIDLTest(parser, harness):
};
"""
)
results = parser.finish()
except:
parser.finish()
except Exception:
threw = True
harness.ok(threw, "Should have thrown on variadic argument with default value.")