DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (4a45ed98fb43)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1245681
-->
<head>
  <title>Test for Bug 1245681</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1245681">Mozilla Bug 1245681</a>
<p id="display"></p>
<div id="content">
  <iframe></iframe>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">

const Ci = SpecialPowers.Ci;
var styleSheets = null;

function runTest() {
  var editframe = window.frames[0];
  var editdoc = editframe.document;
  editdoc.designMode = "on";
  var editor = SpecialPowers.wrap(editframe).docShell.editingSession
                            .getEditorForWindow(editframe);

  styleSheets = editor.QueryInterface(Ci.nsIEditorStyleSheets);

  // test 1: try to access chrome:// url that is accessible to content
  try {
    styleSheets.addOverrideStyleSheet("chrome://browser/content/pageinfo/pageInfo.css");
    ok(true, "should be allowed to access chrome://*.css if contentaccessible");
  } catch (ex) {
    ok(false, "should be allowed to access chrome://*.css if contentaccessible");
  }

  // test 2: try to access chrome:// url that is *not* accessible to content
  // please note that addOverrideStyleSheet() is triggered by the system,
  // so the load should also *always* succeed.
  try {
    styleSheets.addOverrideStyleSheet("chrome://mozapps/skin/aboutServiceWorkers.css");
    ok(true, "should be allowed to access chrome://*.css even if *not* contentaccessible");
  } catch (ex) {
    ok(false, "should be allowed to access chrome://*.css even if *not* contentaccessible");
  }
  SimpleTest.finish();
}

SimpleTest.waitForExplicitFinish();
addLoadEvent(runTest);

</script>
</pre>
</body>
</html>