diff options
author | Shing Lyu <shing.lyu@gmail.com> | 2016-01-29 17:32:39 +0800 |
---|---|---|
committer | Shing Lyu <shing.lyu@gmail.com> | 2016-01-29 21:12:21 +0800 |
commit | 18b6817755b3509990e0a9fbe1acb5318d81c957 (patch) | |
tree | f55fc21d3188f4890532401d0c5d680d08a1c68f /components/script/dom/bindings/codegen/parser | |
parent | 1483a5de32511f4f8e4868e8ae55ef6e8406f0f6 (diff) | |
download | servo-18b6817755b3509990e0a9fbe1acb5318d81c957.tar.gz servo-18b6817755b3509990e0a9fbe1acb5318d81c957.zip |
Add mach test-webidl command
Diffstat (limited to 'components/script/dom/bindings/codegen/parser')
4 files changed, 28 insertions, 10 deletions
diff --git a/components/script/dom/bindings/codegen/parser/WebIDL.py b/components/script/dom/bindings/codegen/parser/WebIDL.py index 8bf415c269b..273824fb1b0 100644 --- a/components/script/dom/bindings/codegen/parser/WebIDL.py +++ b/components/script/dom/bindings/codegen/parser/WebIDL.py @@ -501,6 +501,10 @@ class IDLExposureMixins(): def isExposedInWindow(self): return 'Window' in self.exposureSet + def isExposedOnMainThread(self): + return (self.isExposedInWindow() or + self.isExposedInSystemGlobals()) + def isExposedInAnyWorker(self): return len(self.getWorkerExposureSet()) > 0 @@ -564,6 +568,9 @@ class IDLExternalInterface(IDLObjectWithIdentifier, IDLExposureMixins): def isJSImplemented(self): return False + def isProbablyShortLivingObject(self): + return False + def getNavigatorProperty(self): return None @@ -1409,6 +1416,7 @@ class IDLInterface(IDLObjectWithScope, IDLExposureMixins): identifier == "Unforgeable" or identifier == "UnsafeInPrerendering" or identifier == "LegacyEventInit" or + identifier == "ProbablyShortLivingObject" or identifier == "Abstract"): # Known extended attributes that do not take values if not attr.noArguments(): @@ -1523,6 +1531,14 @@ class IDLInterface(IDLObjectWithScope, IDLExposureMixins): def isJSImplemented(self): return bool(self.getJSImplementation()) + def isProbablyShortLivingObject(self): + current = self + while current: + if current.getExtendedAttribute("ProbablyShortLivingObject"): + return True + current = current.parent + return False + def getNavigatorProperty(self): naviProp = self.getExtendedAttribute("NavigatorProperty") if not naviProp: diff --git a/components/script/dom/bindings/codegen/parser/abstract.patch b/components/script/dom/bindings/codegen/parser/abstract.patch index e971a97e443..081ee91c59b 100644 --- a/components/script/dom/bindings/codegen/parser/abstract.patch +++ b/components/script/dom/bindings/codegen/parser/abstract.patch @@ -1,11 +1,11 @@ --- WebIDL.py +++ WebIDL.py -@@ -1357,7 +1357,8 @@ class IDLInterface(IDLObjectWithScope, IDLExposureMixins): - identifier == "ChromeOnly" or +@@ -1416,7 +1416,8 @@ identifier == "Unforgeable" or identifier == "UnsafeInPrerendering" or -- identifier == "LegacyEventInit"): -+ identifier == "LegacyEventInit" or + identifier == "LegacyEventInit" or +- identifier == "ProbablyShortLivingObject"): ++ identifier == "ProbablyShortLivingObject" or + identifier == "Abstract"): # Known extended attributes that do not take values if not attr.noArguments(): diff --git a/components/script/dom/bindings/codegen/parser/runtests.py b/components/script/dom/bindings/codegen/parser/runtests.py index 98a7d2b81d3..b8d45ef31b5 100644 --- a/components/script/dom/bindings/codegen/parser/runtests.py +++ b/components/script/dom/bindings/codegen/parser/runtests.py @@ -20,20 +20,20 @@ class TestHarness(object): def finish(self): if self.verbose or self.printed_intro: - print "Finished test %s" % self.test + print("Finished test %s" % self.test) def maybe_print_intro(self): if not self.printed_intro: - print "Starting test %s" % self.test + print("Starting test %s" % self.test) self.printed_intro = True def test_pass(self, msg): if self.verbose: - print "TEST-PASS | %s" % msg + print("TEST-PASS | %s" % msg) def test_fail(self, msg): self.maybe_print_intro() - print "TEST-UNEXPECTED-FAIL | %s" % msg + print("TEST-UNEXPECTED-FAIL | %s" % msg) def ok(self, condition, msg): if condition: @@ -46,7 +46,7 @@ class TestHarness(object): self.test_pass(msg) else: self.test_fail(msg) - print "\tGot %s expected %s" % (a, b) + print("\tGot %s expected %s" % (a, b)) def run_tests(tests, verbose): testdir = os.path.join(os.path.dirname(__file__), 'tests') @@ -63,7 +63,7 @@ def run_tests(tests, verbose): try: _test.WebIDLTest.__call__(WebIDL.Parser(), harness) except Exception, ex: - print "TEST-UNEXPECTED-FAIL | Unhandled exception in test %s: %s" % (testpath, ex) + print("TEST-UNEXPECTED-FAIL | Unhandled exception in test %s: %s" % (testpath, ex)) traceback.print_exc() finally: harness.finish() diff --git a/components/script/dom/bindings/codegen/parser/update.sh b/components/script/dom/bindings/codegen/parser/update.sh index a60821670b3..96a98f1ea95 100755 --- a/components/script/dom/bindings/codegen/parser/update.sh +++ b/components/script/dom/bindings/codegen/parser/update.sh @@ -1,2 +1,4 @@ wget https://mxr.mozilla.org/mozilla-central/source/dom/bindings/parser/WebIDL.py?raw=1 -O WebIDL.py patch < abstract.patch + +# TODO: update test files from https://dxr.mozilla.org/mozilla-central/source/dom/bindings/parser/tests |