Bug 1591297 - Fix/remove a couple sanitizer tests now that we don't parse -moz-binding. r=hsivonen

Differential Revision: https://phabricator.services.mozilla.com/D50590

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-10-29 08:32:06 +00:00
parent 4825f0f201
commit 630c46a466
2 changed files with 2 additions and 49 deletions

View file

@ -29,8 +29,8 @@ is(s.sanitize("<a onclick='boom()'></a>", 0), "<html><head></head><body><a></a><
is(s.sanitize("<style>p { color: red; }</style><p style='background-color: blue;'></p>", 0), "<html><head></head><body><p></p></body></html>", "Wrong sanitizer result 4");
// Can allow styles
is(s.sanitize("<style>p { color: red; }</style><p style='background-color: blue;'></p>", u.SanitizerAllowStyle), '<html><head><style>p { color: red; }</style></head><body><p style="background-color: blue;"></p></body></html>', "Wrong sanitizer result 5");
// -moz-binding gets dropped when styles allowed
is(s.sanitize("<style>p { color: red; -moz-binding: url(foo); }</style><p style='background-color: blue; -moz-binding: url(foo);'></p>", u.SanitizerAllowStyle), '<html><head><style>p { color: red; }</style></head><body><p style="background-color: blue;"></p></body></html>', "Wrong sanitizer result 6");
// -moz-binding used to get dropped, but no longer does.
is(s.sanitize("<style>p { color: red; -moz-binding: url(foo); }</style><p style='background-color: blue; -moz-binding: url(foo);'></p>", u.SanitizerAllowStyle), '<html><head><style>p { color: red; -moz-binding: url(foo); }</style></head><body><p style="background-color: blue; -moz-binding: url(foo);"></p></body></html>', "Wrong sanitizer result 6");
// Various cid: embeds only cases
is(s.sanitize("<img src='foo.html'>", u.SanitizerCidEmbedsOnly), '<html><head></head><body><img></body></html>', "Wrong sanitizer result 7");
is(s.sanitize("<img src='cid:foo'>", u.SanitizerCidEmbedsOnly), '<html><head></head><body><img src="cid:foo"></body></html>', "Wrong sanitizer result 8");

View file

@ -207,32 +207,6 @@ var tests = [
rootElement() { return document.getElementById("n"); },
checkResult(html) { isnot(html.indexOf("style"), -1, "Should have retained style"); },
},
{
id: "o",
isIFrame: true,
payload: invalidStyle1Payload,
rootElement() { return document.getElementById("o").contentDocument.documentElement; },
checkResult(html) { is(html.indexOf("binding"), -1, "Should not have retained the binding style"); },
},
{
id: "p",
payload: invalidStyle1Payload,
rootElement() { return document.getElementById("p"); },
checkResult(html) { is(html.indexOf("binding"), -1, "Should not have retained the binding style"); },
},
{
id: "q",
isIFrame: true,
payload: invalidStyle2Payload,
rootElement() { return document.getElementById("q").contentDocument.documentElement; },
checkResult(html) { is(html.indexOf("binding"), -1, "Should not have retained the binding style"); },
},
{
id: "r",
payload: invalidStyle2Payload,
rootElement() { return document.getElementById("r"); },
checkResult(html) { is(html.indexOf("binding"), -1, "Should not have retained the binding style"); },
},
{
id: "s",
isIFrame: true,
@ -285,27 +259,6 @@ var tests = [
rootElement() { return document.getElementById("z"); },
checkResult(html) { isnot(html.indexOf("xxx"), -1, "Should not have retained the font-face style"); },
},
{
id: "aa",
isIFrame: true,
payload: nestedStylePayload,
rootElement() { return document.getElementById("aa").contentDocument.documentElement; },
checkResult(html, text) {
is(html.indexOf("binding-1"), -1, "Should not have retained the binding-1 style");
isnot(text.indexOf("#bar2"), -1, "Should have retained binding-2 as text content");
is(text.indexOf("binding-2"), -1, "Should not have retained binding-2 as a tag");
},
},
{
id: "bb",
payload: nestedStylePayload,
rootElement() { return document.getElementById("bb"); },
checkResult(html, text) {
is(html.indexOf("binding-1"), -1, "Should not have retained the binding-1 style");
isnot(text.indexOf("#bar2"), -1, "Should have retained binding-2 as text content");
is(text.indexOf("binding-2"), -1, "Should not have retained binding-2 as a tag");
},
},
{
id: "cc",
isIFrame: true,