michael@0: def WebIDLTest(parser, harness): michael@0: threw = False michael@0: try: michael@0: parser.parse(""" michael@0: interface Promise {}; michael@0: interface A { michael@0: legacycaller Promise foo(); michael@0: }; michael@0: """) michael@0: results = parser.finish() michael@0: michael@0: except: michael@0: threw = True michael@0: harness.ok(threw, michael@0: "Should not allow Promise return values for legacycaller.") michael@0: michael@0: parser = parser.reset() michael@0: threw = False michael@0: try: michael@0: parser.parse(""" michael@0: interface Promise {}; michael@0: interface A { michael@0: Promise foo(); michael@0: long foo(long arg); michael@0: }; michael@0: """) michael@0: results = parser.finish(); michael@0: except: michael@0: threw = True michael@0: harness.ok(threw, michael@0: "Should not allow overloads which have both Promise and " michael@0: "non-Promise return types.") michael@0: michael@0: parser = parser.reset() michael@0: threw = False michael@0: try: michael@0: parser.parse(""" michael@0: interface Promise {}; michael@0: interface A { michael@0: long foo(long arg); michael@0: Promise foo(); michael@0: }; michael@0: """) michael@0: results = parser.finish(); michael@0: except: michael@0: threw = True michael@0: harness.ok(threw, michael@0: "Should not allow overloads which have both Promise and " michael@0: "non-Promise return types.") michael@0: michael@0: parser = parser.reset() michael@0: parser.parse(""" michael@0: interface Promise {}; michael@0: interface A { michael@0: Promise foo(); michael@0: Promise foo(long arg); michael@0: }; michael@0: """) michael@0: results = parser.finish(); michael@0: michael@0: harness.ok(True, michael@0: "Should allow overloads which only have Promise and return " michael@0: "types.")