blob: e21552f7a12d0b2e6bc3b6d972157c13d1c0fe4c [file] [log] [blame]
<!DOCTYPE html>
<meta name="assert" content="This test checks that a layout() function correctly parses on a secure context." />
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../resources/get-host-info.js"></script>
<style>
#test {
display: flex;
}
</style>
<div id="test"></div>
<script>
if (window.location.origin != get_host_info().AUTHENTICATED_ORIGIN) {
window.location = get_host_info().AUTHENTICATED_ORIGIN + window.location.pathname;
} else {
test(function() {
const element = document.getElementById('test');
assert_true(window.isSecureContext);
element.setAttribute('style', 'display: layout(success)');
assert_equals(getComputedStyle(element).display, 'layout(success)');
element.setAttribute('style', '');
element.style.display = 'layout(success)';
assert_equals(getComputedStyle(element).display, 'layout(success)');
element.style.display = '';
const styleSheet = document.styleSheets[0];
let idx = styleSheet.insertRule(
'#test { display: layout(success); }',
styleSheet.cssRules.length);
assert_equals(getComputedStyle(element).display, 'layout(success)');
styleSheet.deleteRule(idx);
idx = styleSheet.insertRule(
'#test { --bg: layout(success); display: var(--bg); }',
styleSheet.cssRules.length);
assert_equals(getComputedStyle(element).display, 'layout(success)');
styleSheet.deleteRule(idx);
});
}
</script>