blob: dc30933411c4c877c5a270a158011f733f8eb4ef [file] [log] [blame]
<script src=resources/common.js></script>
<script src=../resources/testharness.js></script>
<script src=../resources/testharnessreport.js></script>
<script>
test(t => {
t.add_cleanup(clearUseCounter);
assert_false(internals.isUseCounted(document, kPriorityHints),
'Priority Hints is not use-counted before the importance ' +
'IDL attribute is set');
const script = document.createElement('script');
script.importance = 'high';
assert_true(internals.isUseCounted(document, kPriorityHints),
'Priority Hints is use-counted once the importance IDL ' +
'attribute is set');
}, 'Priority Hints use-counter works properly with the <script> importance ' +
'IDL attribute');
test(t => {
t.add_cleanup(clearUseCounter);
assert_false(internals.isUseCounted(document, kPriorityHints),
'Priority Hints is not use-counted before the importance ' +
'content attribute is set');
const script = document.createElement('script');
script.setAttribute('importance', 'high');
assert_true(internals.isUseCounted(document, kPriorityHints),
'Priority Hints is use-counted once the importance content ' +
'attribute is set');
}, 'Priority Hints use-counter works properly with the <script> importance ' +
'content attribute');
const t = async_test('Priority Hints is use-counted when the importance ' +
'content attribute is parsed on the <script> element');
t.add_cleanup(clearUseCounter);
t.step_func(() => {
assert_false(internals.isUseCounted(document, kPriorityHints),
'Priority Hints is not use-counted before the importance ' +
'content attribute is parsed');
});
window.addEventListener('DOMContentLoaded', t.step_func_done(() => {
document.head.innerHTML += "<script src=../resources/dummy.js " +
"importance=high><" + "/script>";
assert_true(internals.isUseCounted(document, kPriorityHints),
'Priority Hints is use-counted once the importance content ' +
'attribute is parsed');
}));
</script>