Skip to content

Commit

Permalink
Augment COEP violation report
Browse files Browse the repository at this point in the history
This implements whatwg/html#5848.

 - Add "blockedURL" (we'll keep "blocked-url" for some time).
 - Add "disposition".
 - Add "destination".

There are subtle bugs in WPTs
(#25177). Fix them.

Bug: 1119676
Change-Id: I9b83f18d9881b2742bafd88405b57645a67cac49
  • Loading branch information
yutakahirano authored and chromium-wpt-export-bot committed Aug 26, 2020
1 parent a7f851a commit b117625
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
}
});
observer.observe();
const url = `${REMOTE_ORIGIN}$/common/utils.js`;
const url = `${REMOTE_ORIGIN}/common/utils.js`;
const script = frame.contentDocument.createElement('script');
script.src = url;
frame.contentDocument.body.appendChild(script);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
pollReports('endpoint', reports);
pollReports('report-only-endpoint', reportsForReportOnly);

function checkCorpReportExistence(reports, blockedUrl, contextUrl, disposition) {
function checkCorpReportExistence(reports, blockedUrl, contextUrl, destination, disposition) {
blockedUrl = new URL(blockedUrl, location).href;
contextUrl = new URL(contextUrl, location).href;
for (const report of reports) {
Expand All @@ -54,7 +54,7 @@
}
if (report.body.blockedURL === blockedUrl &&
report.body.disposition === disposition) {
assert_equals(report.body.destination, '');
assert_equals(report.body.destination, destination);
return;
}
}
Expand Down Expand Up @@ -97,9 +97,9 @@
// Wait 3 seconds for reports to settle.
await wait(3000);

checkCorpReportExistence(reports, url, iframe.src, 'enforce');
checkCorpReportExistence(reports, url, iframe.src, '', 'enforce');
checkCorpReportExistence(
reportsForReportOnly, url, iframe.src, 'reporting');
reportsForReportOnly, url, iframe.src, '', 'reporting');

t.done();
} catch (e) {
Expand Down Expand Up @@ -134,9 +134,9 @@
// Wait 3 seconds for reports to settle.
await wait(3000);

checkCorpReportExistence(reports, url, iframe.src, 'enforce');
checkCorpReportExistence(reports, url, iframe.src, 'iframe', 'enforce');
checkCorpReportExistence(
reportsForReportOnly, url, iframe.src, 'reporting');
reportsForReportOnly, url, iframe.src, 'iframe', 'reporting');

t.done();
} catch (e) {
Expand Down

0 comments on commit b117625

Please sign in to comment.