Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<html>
<head>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<script src='../resources/document-policy-report-json.js'></script>
</head>
<body>
<img src="./oversized.jpg" alt="oversized image" width="50" height="50">
<script>
async_test(t => {
new ReportingObserver(
t.step_func_done((reports, _) => {
assert_greater_than(reports.length, 0);
const report = reports[0];
assert_equals(report.type, "document-policy-violation");
assert_equals(report.url, document.location.href);
const rbody = report.body;
assert_equals(rbody.featureId, "oversized-images");
assert_equals(rbody.sourceFile, document.getElementsByTagName('img')[0].src);
assert_equals(rbody.lineNumber, null);
assert_equals(rbody.columnNumber, null);
check_report_json(reports[0]);
}),
{types: ['document-policy-violation'], buffered: true}
).observe();
},
"oversized-images Report Format")
</script>
</body>
</html>