def run_regex(self, input, is_js=None, filename=None): """Run the standard regex tests for non-JavaScript input.""" if is_js: input = "'use strict';\n%s" % input regex.run_regex_tests(input, self.err, filename or 'foo.js') else: input = '<input onclick="%s" />' % input regex.run_regex_tests(input, self.err, filename or 'foo.html')
def run_regex(self, input, is_js=False): """Run the standard regex tests for non-JavaScript input.""" if self.err is None: self.setup_err() if not is_js: input = '<input onclick="%s" />' % input else: input = "'use strict';\n%s" % input regex.run_regex_tests(input, self.err, 'foo.txt', is_js=is_js)
def test_incompatible_uris(): """Flag instances of javascript:/data: in compatibility.""" fx6 = {"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}": version_range("firefox", "6.0a1")} err = _do_test_raw(""" var f = "javascript:foo();"; """) assert not err.failed() assert not any(err.compat_summary.values()) err = ErrorBundle() err.supported_versions = fx6 regex_tests.run_regex_tests(""" var f = "javascript:foo();"; """, err, "foo.bar", is_js=False) assert not err.failed() assert not any(err.compat_summary.values()) err = _do_test_raw(""" var f = "javascript:foo();"; """, versions=fx6) assert not err.failed() assert err.compat_summary["warnings"] err = _do_test_raw(""" var f = "data:foo();"; """, versions=fx6) assert not err.failed() assert err.compat_summary["warnings"] err = _do_test_raw(""" var foo = "postdata:LOL NOT THE CASE"; """, versions=fx6) assert not err.failed() assert not any(err.compat_summary.values()) err = _do_test_raw(""" var foo = { data: "LOL NOT THE CASE" }; """, versions=fx6) assert not err.failed() assert not any(err.compat_summary.values())
def run_js_regex(self, input): """Run the standard regex tests for JavaScript input.""" if self.err is None: self.setup_err() regex.run_regex_tests(input, self.err, "foo.txt", is_js=True)
def run_regex(self, input): """Run the standard regex tests for non-JavaScript input.""" if self.err is None: self.setup_err() input = '<input onclick="%s" />' % input regex.run_regex_tests(input, self.err, "foo.txt", is_js=False)
def run_js_regex(self, input): """Run the standard regex tests for JavaScript input.""" if self.err is None: self.setup_err() regex.run_regex_tests(input, self.err, 'foo.txt', is_js=True)
def run_js_regex(self, input, filename='foo.js'): """Run the standard regex tests for JavaScript input.""" regex.run_regex_tests(input, self.err, filename)