Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
727 additions
and
221 deletions.
There are no files selected for viewing
337 changes: 231 additions & 106 deletions
337
components/script/dom/bindings/codegen/parser/WebIDL.py
Large diffs are not rendered by default.
Oops, something went wrong.
10 changes: 5 additions & 5 deletions
10
components/script/dom/bindings/codegen/parser/abstract.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
--- WebIDL.py | ||
+++ WebIDL.py | ||
@@ -1786,7 +1786,8 @@ class IDLInterface(IDLInterfaceOrNamespace): | ||
identifier == "ProbablyShortLivingWrapper" or | ||
@@ -1768,7 +1768,8 @@ class IDLInterface(IDLInterfaceOrNamespace): | ||
identifier == "LegacyUnenumerableNamedProperties" or | ||
identifier == "RunConstructorInCallerCompartment" or | ||
- identifier == "WantsEventListenerHooks"): | ||
+ identifier == "WantsEventListenerHooks" or | ||
identifier == "WantsEventListenerHooks" or | ||
- identifier == "Serializable"): | ||
+ identifier == "Serializable" or | ||
+ identifier == "Abstract"): | ||
# Known extended attributes that do not take values | ||
if not attr.noArguments(): | ||
raise WebIDLError("[%s] must take no arguments" % identifier, | ||
raise WebIDLError("[%s] must take no arguments" % identifier, |
6 changes: 3 additions & 3 deletions
6
components/script/dom/bindings/codegen/parser/callback-location.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
components/script/dom/bindings/codegen/parser/pref-main-thread.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
components/script/dom/bindings/codegen/parser/tests/test_callback_constructor.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import WebIDL | ||
|
||
def WebIDLTest(parser, harness): | ||
parser.parse(""" | ||
interface TestCallbackConstructor { | ||
attribute CallbackConstructorType? constructorAttribute; | ||
}; | ||
callback constructor CallbackConstructorType = TestCallbackConstructor (unsigned long arg); | ||
""") | ||
|
||
results = parser.finish() | ||
|
||
harness.ok(True, "TestCallbackConstructor 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(), "::TestCallbackConstructor", "Interface has the right QName") | ||
harness.check(iface.identifier.name, "TestCallbackConstructor", "Interface has the right name") | ||
harness.check(len(iface.members), 1, "Expect %s members" % 1) | ||
|
||
attr = iface.members[0] | ||
harness.ok(isinstance(attr, WebIDL.IDLAttribute), | ||
"Should be an IDLAttribute") | ||
harness.ok(attr.isAttr(), "Should be an attribute") | ||
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(), "::TestCallbackConstructor::constructorAttribute", "Attr has the right QName") | ||
harness.check(attr.identifier.name, "constructorAttribute", "Attr has the right name") | ||
t = attr.type | ||
harness.ok(not isinstance(t, WebIDL.IDLWrapperType), "Attr has the right type") | ||
harness.ok(isinstance(t, WebIDL.IDLNullableType), "Attr has the right type") | ||
harness.ok(t.isCallback(), "Attr has the right type") | ||
|
||
callback = results[1] | ||
harness.ok(callback.isConstructor(), "Callback is constructor") | ||
|
||
parser.reset() | ||
threw = False | ||
try: | ||
parser.parse(""" | ||
[TreatNonObjectAsNull] | ||
callback constructor CallbackConstructorType = object (); | ||
""") | ||
results = parser.finish() | ||
except: | ||
threw = True | ||
|
||
harness.ok(threw, "Should throw on TreatNonObjectAsNull callback constructors") | ||
|
||
parser.reset() | ||
threw = False | ||
try: | ||
parser.parse(""" | ||
[MOZ_CAN_RUN_SCRIPT_BOUNDARY] | ||
callback constructor CallbackConstructorType = object (); | ||
""") | ||
results = parser.finish() | ||
except: | ||
threw = True | ||
|
||
harness.ok(threw, "Should not permit MOZ_CAN_RUN_SCRIPT_BOUNDARY callback constructors") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
components/script/dom/bindings/codegen/parser/tests/test_constructor_global.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
def WebIDLTest(parser, harness): | ||
threw = False | ||
try: | ||
parser.parse(""" | ||
[Constructor, Global] | ||
interface TestConstructorGlobal { | ||
}; | ||
""") | ||
|
||
results = parser.finish() | ||
except: | ||
threw = True | ||
|
||
harness.ok(threw, "Should have thrown.") | ||
|
||
parser = parser.reset() | ||
threw = False | ||
try: | ||
parser.parse(""" | ||
[Global, Constructor] | ||
interface TestConstructorGlobal { | ||
}; | ||
""") | ||
|
||
results = parser.finish() | ||
except: | ||
threw = True | ||
|
||
harness.ok(threw, "Should have thrown.") | ||
|
||
parser = parser.reset() | ||
threw = False | ||
try: | ||
parser.parse(""" | ||
[Global, NamedConstructor=FooBar] | ||
interface TestNamedConstructorGlobal { | ||
}; | ||
""") | ||
results = parser.finish() | ||
except: | ||
threw = True | ||
|
||
harness.ok(threw, "Should have thrown.") | ||
|
||
parser = parser.reset() | ||
threw = False | ||
try: | ||
parser.parse(""" | ||
[NamedConstructor=FooBar, Global] | ||
interface TestNamedConstructorGlobal { | ||
}; | ||
""") | ||
results = parser.finish() | ||
except: | ||
threw = True | ||
|
||
harness.ok(threw, "Should have thrown.") | ||
|
||
parser = parser.reset() | ||
threw = False | ||
try: | ||
parser.parse(""" | ||
[Global, HTMLConstructor] | ||
interface TestHTMLConstructorGlobal { | ||
}; | ||
""") | ||
|
||
results = parser.finish() | ||
except: | ||
threw = True | ||
|
||
harness.ok(threw, "Should have thrown.") | ||
|
||
parser = parser.reset() | ||
threw = False | ||
try: | ||
parser.parse(""" | ||
[HTMLConstructor, Global] | ||
interface TestHTMLConstructorGlobal { | ||
}; | ||
""") | ||
|
||
results = parser.finish() | ||
except: | ||
threw = True | ||
|
||
harness.ok(threw, "Should have thrown.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.