1
0
Fork 0
firefox/layout/style/test/test_sheet_privilege.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

33 lines
1 KiB
HTML

<!doctype html>
<title>Test whether it can access a filed in MediaList with normal privilege after accessing with chrome privilege.</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<style>
@media screen and (max-width: 800px) {
body {
background-color: lime;
}
}
</style>
<script>
"use strict";
function assertMediaText(rule, description) {
is(rule.media.mediaText, "screen and (max-width: 800px)", description);
}
add_task(function testCssRuleMedia() {
assertMediaText(SpecialPowers.wrap(document).styleSheets[0].cssRules[0], "privileged document");
assertMediaText(document.styleSheets[0].cssRules[0], "unprivileged document");
});
add_task(function testSheetFromCache() {
for (let i = 0; i < 2; ++i) {
const style = document.createElement("style");
style.textContent = `@media screen and (max-width: 800px) {}`;
document.head.append(style);
assertMediaText(SpecialPowers.wrap(style).sheet.cssRules[0], "privileged sheet " + i);
assertMediaText(style.sheet.cssRules[0], "unprivileged sheet " + i);
}
});
</script>