mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1770888 - tests r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D156800
This commit is contained in:
parent
09f6372676
commit
92f896ab7e
@ -1010,4 +1010,20 @@ var vectors = [
|
||||
data: "<svg><template></template></svg>",
|
||||
sanitized: "<html><head></head><body></body></html>",
|
||||
},
|
||||
{
|
||||
data: "<svg><use href='http://example.com/test.svg'></svg>",
|
||||
flags: 1, // ParserUtils.SanitizerAllowStyle
|
||||
sanitized: "<html><head></head><body><svg><use></use></svg></body></html>",
|
||||
},
|
||||
{
|
||||
// fragments that reference the same document are allowed.
|
||||
data: "<svg><use href='#x'></svg>",
|
||||
flags: 1, // ParserUtils.SanitizerAllowStyle
|
||||
sanitized: '<html><head></head><body><svg><use href="#x"></use></svg></body></html>',
|
||||
},
|
||||
{
|
||||
data: '<svg><use xlink:href="http://example/#baz"/></svg>',
|
||||
flags: 1, // ParserUtils.SanitizerAllowStyl,
|
||||
sanitized: "<html><head></head><body><svg><use></use></svg></body></html>",
|
||||
},
|
||||
];
|
||||
|
@ -43,9 +43,11 @@ function run_test() {
|
||||
// and default settings
|
||||
|
||||
for (var item in vectors) {
|
||||
var evil = vectors[item].data;
|
||||
var sanitized = vectors[item].sanitized;
|
||||
var out = ParserUtils.sanitize(evil, sanitizeFlags);
|
||||
let { data, sanitized, flags } = vectors[item];
|
||||
if (!flags) {
|
||||
flags = sanitizeFlags;
|
||||
}
|
||||
var out = ParserUtils.sanitize(data, flags);
|
||||
Assert.equal(sanitized, out);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user