Incorrect docDomain for onBlockableItem allowlisting events on sub_frames
While working on onBlockableItem in MV3, I noticed something incorrect in the following test:
it("logs allowlisting for different domain iframe", async function() {
await checkLogging(
[`@@|${TEST_PAGES_URL}/image.html^$document`],
"allowingEventOptions",
() => new Page(`${CROSS_DOMAIN_URL}/iframe.html`, true).loaded,
[{
filter: expectedAllowingFilter(
`@@|${TEST_PAGES_URL}/image.html^$document`
),
matchInfo: {
...allowingMatchInfo,
docDomain: CROSS_DOMAIN,
allowingReason: "document"
},
request: expectedRequestRelativeUrl("image.html")
}, {
filter: expectedAllowingFilter(
`@@|${TEST_PAGES_URL}/image.html^$document`
),
matchInfo: {
...allowingMatchInfo,
docDomain: TEST_PAGES_DOMAIN, // <- THIS IS INCORRECT, IT SHOULD BE CROSS_DOMAIN
specificOnly: false
},
request: expectedRequestRelativeUrl("image.html")
}, {
filter: expectedAllowingFilter(
`@@|${TEST_PAGES_URL}/image.html^$document`
),
matchInfo: {
...allowingMatchInfo,
docDomain: TEST_PAGES_DOMAIN,
specificOnly: false
},
request: expectedRequestRelativeUrl("image.png")
}]
);
});
The docDomain for the request that loads the sub_frame itself should be the domain of the parent document, since that is the document that the sub_frame appears on.
This event is logged as part of CSP filtering. It may also imply that CSP filters that use domain filtering to apply a CSP filter to iframes are working incorrectly, or that CSP filters have inconsistent rules regaring what the docDomain should be.