layout/style/test/test_medialist_privilege.html
author Jan de Mooij <jdemooij@mozilla.com>
Mon, 27 Sep 2021 11:15:49 +0000
changeset 593265 5144ad09cfb7011b98c5422b78b82936b1343541
parent 555192 16914662147b7366b628fd60b5d6bc3e4f6c05fa
permissions -rw-r--r--
Bug 1732281 part 2 - Transpile ValueToIteratorResult in Warp. r=iain Depends on D126514 Differential Revision: https://phabricator.services.mozilla.com/D126515

<!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>