blob: 796661145900b0f8f76af565a7882d3d945414c5 [file] [log] [blame]
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../resources/get-host-info.js"></script>
<style>
#test {
background: green;
}
</style>
<div id="test"></div>
<script>
if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) {
window.location = get_host_info().UNAUTHENTICATED_ORIGIN + window.location.pathname;
} else {
test(function() {
const GREEN = 'rgb(0, 128, 0)';
const DEFAULT = 'rgba(0, 0, 0, 0)';
const element = document.getElementById('test');
assert_false(window.isSecureContext);
element.setAttribute('style', 'background: paint(fail) purple');
assert_equals(getComputedStyle(element).backgroundColor, GREEN);
element.setAttribute('style', '');
element.style.background = 'paint(fail) purple';
assert_equals(getComputedStyle(element).backgroundColor, GREEN);
element.style.background = '';
const styleSheet = document.styleSheets[0];
let idx = styleSheet.insertRule(
'#test { background: paint(fail) purple; }',
styleSheet.cssRules.length);
assert_equals(getComputedStyle(element).backgroundColor, GREEN);
styleSheet.deleteRule(idx);
idx = styleSheet.insertRule(
'#test { --bg: paint(fail) purple; background: var(--bg); }',
styleSheet.cssRules.length);
assert_equals(getComputedStyle(element).backgroundColor, DEFAULT);
styleSheet.deleteRule(idx);
});
}
</script>