Allow "on" attributes that have a dash (bug 981221)
This commit is contained in:
Родитель
be5bf89c32
Коммит
f24da163f2
|
@ -167,8 +167,9 @@ class MarkupParser(HTMLParser):
|
||||||
csstester.test_css_snippet(
|
csstester.test_css_snippet(
|
||||||
self.err, self.filename, attr_dict["style"], self.line)
|
self.err, self.filename, attr_dict["style"], self.line)
|
||||||
|
|
||||||
|
event_attribute = lambda k: k.startswith("on") and "-" not in k
|
||||||
script_attributes = dict(
|
script_attributes = dict(
|
||||||
(k, v) for k, v in attr_dict.iteritems() if k.startswith("on"))
|
(k, v) for k, v in attr_dict.iteritems() if event_attribute(k))
|
||||||
if script_attributes:
|
if script_attributes:
|
||||||
if any(k in DOM_MUTATION_HANDLERS for k in script_attributes):
|
if any(k in DOM_MUTATION_HANDLERS for k in script_attributes):
|
||||||
self.err.error(
|
self.err.error(
|
||||||
|
|
|
@ -181,6 +181,14 @@ def test_script_attrs():
|
||||||
""", "foo.xul", should_fail_csp=True)
|
""", "foo.xul", should_fail_csp=True)
|
||||||
|
|
||||||
|
|
||||||
|
def test_script_like_attrs():
|
||||||
|
"""Test that attributes like on-click are okay."""
|
||||||
|
|
||||||
|
_test_xul_raw("""<foo><bar on-zap="asdf" /></foo>""",
|
||||||
|
"foo.xul",
|
||||||
|
should_fail_csp=False)
|
||||||
|
|
||||||
|
|
||||||
def test_dom_mutation():
|
def test_dom_mutation():
|
||||||
"""Test that DOM mutation events are warned against. This should fail both
|
"""Test that DOM mutation events are warned against. This should fail both
|
||||||
the standard tests as well as the CSP tests."""
|
the standard tests as well as the CSP tests."""
|
||||||
|
|
Загрузка…
Ссылка в новой задаче