<!DOCTYPE html>
<html>
<head>
<style>
permission {
font-size: xxx-large;
margin: 0px;
}
</style>
</head>
<body>
<permission id="geolocation" type="geolocation">
<permission id="microphone" type="microphone">
<permission id="camera" type="camera">
<permission id="invalid" type="invalid microphone">
<permission id="camera-microphone" type="camera microphone">
<script>
document.querySelectorAll('permission').forEach(permissionElement => {
// Console logs are used to inform the browser test which events
// have been seen.
permissionElement.addEventListener('resolve', (event) => {
console.log(event.target.id + '-resolve');
});
permissionElement.addEventListener('dismiss', (event) => {
console.log(event.target.id + '-dismiss');
});
});
function clickById(element_id) {
click(document.getElementById(element_id));
}
function click(element) {
element.click();
}
// Waits until the given permission element is granted.
function notifyWhenGranted(id) {
if (document.getElementById(id).matches(':granted')) {
console.log(id + '-granted');
} else {
window.setTimeout(() => {
notifyWhenGranted(id);
}, 50);
}
}
function setFontSizeSmall() {
document.querySelectorAll('permission').forEach((el) => {
el.style.fontSize = 'small';
});
}
</script>
</body>
</html>