Commit c46b9cb1 authored by Charlie Hu's avatar Charlie Hu Committed by Chromium LUCI CQ

[Frame Policy] Add test to verify frame policy works correctly in javascript url

Previous fix(https://chromium-review.googlesource.com/c/chromium/src/+/2181318)
on uninitialized frame policy in javascript url
navigation does not include a test case because it is a security
fix.

Since the fix has landed in M84 which is stable right now, this CL
adds the test case for the fix.

Bug: 1074340
Change-Id: Ia10a972183b02cdac28a2f29cabb7f13caf168e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2297708
Commit-Queue: Charlie Hu <chenleihu@google.com>
Reviewed-by: default avatarIan Clelland <iclelland@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837169}
parent 115c1a20
<!DOCTYPE html>
<head>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
</head>
<body>
<script>
'use strict';
const script = 'script';
const testPage = `
<${script}>
parent.postMessage(document.fullscreenEnabled, '*');
</${script}>
`;
function runTest(allow, expectation) {
return new Promise((resolve, reject) => {
window.onmessage = event => resolve(event.data);
const iframe = document.createElement("iframe");
iframe.allow = allow;
iframe.src = `javascript: \`${testPage}\``;
document.body.appendChild(iframe);
}).then(enabled => {
assert_equals(enabled, expectation);
});
}
promise_test(() => runTest('fullscreen *', true),
'allow attribute(container policy) can enable feature on javascript generated document');
promise_test(() => runTest("fullscreen 'none'", false),
'allow attribute(container policy) can disable feature on javascript generated document');
</script>
</body>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment