Bug 1673199: Add a test whether it can access a filed in MediaList with normal privilege after accessing with chrome privilege. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D95257
This commit is contained in:
Daisuke Akatsuka 2020-10-30 09:37:19 +00:00
Родитель c0c1814841
Коммит c3aace4366
2 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -412,3 +412,4 @@ skip-if = xorigin # Crashes, Assertion failure: mInFlightProcessId == 0, at /bui
[test_non_matching_sheet_media.html]
[test_use_counters.html]
skip-if = !nightly_build
[test_medialist_privilege.html]

Просмотреть файл

@ -0,0 +1,25 @@
<!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";
const chromeDocument = SpecialPowers.wrap(document);
assertMediaText(chromeDocument);
assertMediaText(document);
function assertMediaText(doc) {
const stylesheet = doc.styleSheets[0];
const rule = stylesheet.cssRules[0];
const media = rule.media;
is(rule.media.mediaText, "screen and (max-width: 800px)");
}
</script>