Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove [PrimaryGlobal]
  • Loading branch information
saschanaz committed Oct 3, 2019
1 parent 84693d8 commit 2660f35
Show file tree
Hide file tree
Showing 167 changed files with 413 additions and 825 deletions.
4 changes: 0 additions & 4 deletions components/script/dom/bindings/codegen/CodegenRust.py
Expand Up @@ -827,10 +827,6 @@ def wrapObjectTemplate(templateBody, nullValue, isDefinitelyObject, type,
elif isArgument:
descriptorType = descriptor.argumentType

if descriptor.interface.isConsequential():
raise TypeError("Consequential interface %s being used as an "
"argument" % descriptor.interface.identifier.name)

if failureCode is None:
substitutions = {
"sourceDescription": sourceDescription,
Expand Down
5 changes: 0 additions & 5 deletions components/script/dom/bindings/codegen/Configuration.py
Expand Up @@ -38,11 +38,6 @@ def __init__(self, filename, parseData):
iface = thing
self.interfaces[iface.identifier.name] = iface
if iface.identifier.name not in config:
# Completely skip consequential interfaces with no descriptor
# if they have no interface object because chances are we
# don't need to do anything interesting with them.
if iface.isConsequential() and not iface.hasInterfaceObject():
continue
entry = {}
else:
entry = config[iface.identifier.name]
Expand Down
315 changes: 78 additions & 237 deletions components/script/dom/bindings/codegen/parser/WebIDL.py

Large diffs are not rendered by default.

@@ -1,8 +1,10 @@
import traceback

def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
[Global]
[Global, Exposed=TestConstructorGlobal]
interface TestConstructorGlobal {
constructor();
};
Expand All @@ -18,7 +20,8 @@ def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
[Global, NamedConstructor=FooBar]
[Global, Exposed=TestNamedConstructorGlobal,
NamedConstructor=FooBar]
interface TestNamedConstructorGlobal {
};
""")
Expand All @@ -32,7 +35,8 @@ def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
[NamedConstructor=FooBar, Global]
[NamedConstructor=FooBar, Global,
Exposed=TestNamedConstructorGlobal]
interface TestNamedConstructorGlobal {
};
""")
Expand All @@ -46,7 +50,7 @@ def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
[Global, HTMLConstructor]
[Global, HTMLConstructor, Exposed=TestHTMLConstructorGlobal]
interface TestHTMLConstructorGlobal {
};
""")
Expand All @@ -61,7 +65,7 @@ def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
[HTMLConstructor, Global]
[HTMLConstructor, Global, Exposed=TestHTMLConstructorGlobal]
interface TestHTMLConstructorGlobal {
};
""")
Expand Down
Expand Up @@ -736,3 +736,17 @@ def WebIDLTest(parser, harness):
threw = True

harness.ok(threw, "Only unrestricted values can be initialized to NaN")

parser = parser.reset();
threw = False
try:
parser.parse("""
dictionary Foo {
long module;
};
""")
results = parser.finish()
except:
threw = True

harness.ok(not threw, "Should be able to use 'module' as a dictionary member name")
Expand Up @@ -59,8 +59,6 @@ def WebIDLTest(parser, harness):
void passKid(Kid arg);
void passParent(Parent arg);
void passGrandparent(Grandparent arg);
void passImplemented(Implemented arg);
void passImplementedParent(ImplementedParent arg);
void passUnrelated1(Unrelated1 arg);
void passUnrelated2(Unrelated2 arg);
void passArrayBuffer(ArrayBuffer arg);
Expand All @@ -70,9 +68,6 @@ def WebIDLTest(parser, harness):
interface Kid : Parent {};
interface Parent : Grandparent {};
interface Grandparent {};
interface Implemented : ImplementedParent {};
Parent implements Implemented;
interface ImplementedParent {};
interface Unrelated1 {};
interface Unrelated2 {};
""")
Expand Down Expand Up @@ -156,8 +151,7 @@ def WebIDLTest(parser, harness):
argTypes = [ "long", "short", "long?", "short?", "boolean",
"boolean?", "DOMString", "ByteString", "Enum", "Enum2",
"Interface", "Interface?",
"AncestorInterface", "UnrelatedInterface",
"ImplementedInterface", "CallbackInterface",
"AncestorInterface", "UnrelatedInterface", "CallbackInterface",
"CallbackInterface?", "CallbackInterface2",
"object", "Callback", "Callback2", "Dict",
"Dict2", "sequence<long>", "sequence<short>",
Expand Down Expand Up @@ -190,7 +184,7 @@ def allBut(list1, list2):
bufferSourceTypes = ["ArrayBuffer", "ArrayBufferView", "Uint8Array", "Uint16Array"]
sharedBufferSourceTypes = ["SharedArrayBuffer"]
interfaces = [ "Interface", "Interface?", "AncestorInterface",
"UnrelatedInterface", "ImplementedInterface" ] + bufferSourceTypes + sharedBufferSourceTypes
"UnrelatedInterface" ] + bufferSourceTypes + sharedBufferSourceTypes
nullables = (["long?", "short?", "boolean?", "Interface?",
"CallbackInterface?", "Dict", "Dict2",
"Date?", "any", "Promise<any>?"] +
Expand Down Expand Up @@ -230,7 +224,6 @@ def setDistinguishable(type, types):
setDistinguishable("AncestorInterface", notRelatedInterfaces)
setDistinguishable("UnrelatedInterface",
allBut(argTypes, ["object", "UnrelatedInterface"]))
setDistinguishable("ImplementedInterface", notRelatedInterfaces)
setDistinguishable("CallbackInterface", nonUserObjects)
setDistinguishable("CallbackInterface?", allBut(nonUserObjects, nullables))
setDistinguishable("CallbackInterface2", nonUserObjects)
Expand Down Expand Up @@ -272,8 +265,6 @@ def checkDistinguishability(parser, type1, type2):
interface Interface : AncestorInterface {};
interface AncestorInterface {};
interface UnrelatedInterface {};
interface ImplementedInterface {};
Interface implements ImplementedInterface;
callback interface CallbackInterface {};
callback interface CallbackInterface2 {};
callback Callback = any();
Expand Down
Expand Up @@ -2,9 +2,9 @@

def WebIDLTest(parser, harness):
parser.parse("""
[PrimaryGlobal] interface Foo {};
[Global=(Bar1,Bar2)] interface Bar {};
[Global=Baz2] interface Baz {};
[Global, Exposed=Foo] interface Foo {};
[Global=(Bar, Bar1,Bar2), Exposed=Bar] interface Bar {};
[Global=(Baz, Baz2), Exposed=Baz] interface Baz {};
[Exposed=(Foo,Bar1)]
interface Iface {
Expand Down Expand Up @@ -51,10 +51,11 @@ def WebIDLTest(parser, harness):

parser = parser.reset()
parser.parse("""
[PrimaryGlobal] interface Foo {};
[Global=(Bar1,Bar2)] interface Bar {};
[Global=Baz2] interface Baz {};
[Global, Exposed=Foo] interface Foo {};
[Global=(Bar, Bar1, Bar2), Exposed=Bar] interface Bar {};
[Global=(Baz, Baz2), Exposed=Baz] interface Baz {};
[Exposed=Foo]
interface Iface2 {
void method3();
};
Expand All @@ -80,21 +81,21 @@ def WebIDLTest(parser, harness):

parser = parser.reset()
parser.parse("""
[PrimaryGlobal] interface Foo {};
[Global=(Bar1,Bar2)] interface Bar {};
[Global=Baz2] interface Baz {};
[Global, Exposed=Foo] interface Foo {};
[Global=(Bar, Bar1, Bar2), Exposed=Bar] interface Bar {};
[Global=(Baz, Baz2), Exposed=Baz] interface Baz {};
[Exposed=Foo]
interface Iface3 {
void method4();
};
[Exposed=(Foo,Bar1)]
interface Mixin {
interface mixin Mixin {
void method5();
};
Iface3 implements Mixin;
Iface3 includes Mixin;
""")
results = parser.finish()
harness.check(len(results), 6, "Should know about six things");
Expand Down Expand Up @@ -181,8 +182,8 @@ def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
[Global] interface Foo {};
[Global] interface Bar {};
[Global, Exposed=Foo] interface Foo {};
[Global, Exposed=Bar] interface Bar {};
[Exposed=Foo]
interface Baz {
Expand All @@ -198,25 +199,40 @@ def WebIDLTest(parser, harness):
harness.ok(threw, "Should have thrown on member exposed where its interface is not.")

parser = parser.reset()
threw = False
try:
parser.parse("""
[Global] interface Foo {};
[Global] interface Bar {};
parser.parse("""
[Global, Exposed=Foo] interface Foo {};
[Global, Exposed=Bar] interface Bar {};
[Exposed=Foo]
interface Baz {
void method();
};
[Exposed=Foo]
interface Baz {
void method();
};
[Exposed=Bar]
interface Mixin {};
[Exposed=Bar]
interface mixin Mixin {
void otherMethod();
};
Baz implements Mixin;
""")
Baz includes Mixin;
""")

results = parser.finish()

harness.check(len(results), 5, "Should know about five things");
iface = results[2]
harness.ok(isinstance(iface, WebIDL.IDLInterface),
"Should have an interface here");
members = iface.members
harness.check(len(members), 2, "Should have two members")

harness.ok(members[0].exposureSet == set(["Foo"]),
"method should have the right exposure set")
harness.ok(members[0]._exposureGlobalNames == set(["Foo"]),
"method should have the right exposure global names")

harness.ok(members[1].exposureSet == set(["Bar"]),
"otherMethod should have the right exposure set")
harness.ok(members[1]._exposureGlobalNames == set(["Bar"]),
"otherMethod should have the right exposure global names")

results = parser.finish()
except Exception as x:
threw = True

harness.ok(threw, "Should have thrown on LHS of implements being exposed where RHS is not.")
@@ -1,9 +1,10 @@
def WebIDLTest(parser, harness):
parser.parse("""
[Global]
[Global, Exposed=Foo]
interface Foo : Bar {
getter any(DOMString name);
};
[Exposed=Foo]
interface Bar {};
""")

Expand All @@ -18,7 +19,7 @@ def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
[Global]
[Global, Exposed=Foo]
interface Foo {
getter any(DOMString name);
setter void(DOMString name, any arg);
Expand All @@ -36,7 +37,7 @@ def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
[Global]
[Global, Exposed=Foo]
interface Foo {
getter any(DOMString name);
deleter void(DOMString name);
Expand All @@ -54,7 +55,7 @@ def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
[Global, OverrideBuiltins]
[Global, OverrideBuiltins, Exposed=Foo]
interface Foo {
};
""")
Expand All @@ -70,10 +71,10 @@ def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
[Global]
[Global, Exposed=Foo]
interface Foo : Bar {
};
[OverrideBuiltins]
[OverrideBuiltins, Exposed=Foo]
interface Bar {
};
""")
Expand All @@ -89,9 +90,10 @@ def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
[Global]
[Global, Exposed=Foo]
interface Foo {
};
[Exposed=Foo]
interface Bar : Foo {
};
""")
Expand Down

0 comments on commit 2660f35

Please sign in to comment.