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 (fddffdeab170)

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 59 60 61 62 63 64 65 66 67 68
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=777467
-->
<head>
  <meta charset="utf-8">
  <title>Test app principal's equality</title>
  <script type="application/javascript" 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=777467">Mozilla Bug 777467</a>
<p id="display"></p>
<script>
  // Initialization.
  SpecialPowers.addPermission("browser", true, document);
  SpecialPowers.addPermission("embed-apps", true, document);

  SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
  SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", false);
</script>
<div id="content" style="display: none;">
  <iframe src="error404"></iframe>
  <iframe mozbrowser src="error404"></iframe>
  <iframe mozapp="http://example.org/manifest.webapp" mozbrowser src="error404"></iframe>
</div>
<pre id="test">
<script type="application/javascript">

/** Test for app principal's equality **/

SimpleTest.waitForExplicitFinish();

function canAccessDocument(win) {
  var result = true;
  try {
    win.document;
  } catch(e) {
    result = false;
  }
  return result;
}

addLoadEvent(function() {
  // Test the witness frame (we can access same-origin frame).
  is(canAccessDocument(frames[0]), true,
     "should be able to access the first frame");

  // Test different app/browserElement frames.
  for (var i=1; i<frames.length; ++i) {
    is(canAccessDocument(frames[i]), false,
       "should not be able to access the other frames");
  }

  // Cleanup.
  SpecialPowers.clearUserPref('dom.mozBrowserFramesEnabled');
  SpecialPowers.clearUserPref('dom.ipc.browser_frames.oop_by_default');
  SpecialPowers.removePermission("browser", window.document);
  SpecialPowers.removePermission("embed-apps", window.document);

  SimpleTest.finish();
});

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