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 (205d1b4e8f69)

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
<!DOCTYPE html>
<html>
<head>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none;">

</div>

<iframe></iframe>

<pre id="test">

<script class="testbody" type="application/javascript">
function getEditor() {
  let editframe = window.frames[0];
  return SpecialPowers.wrap(editframe).docShell.editingSession
                      .getEditorForWindow(editframe);
}

SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
  let editdoc = window.frames[0].document;
  editdoc.designMode = "on";
  let editor = getEditor();

  editor.documentCharacterSet = "us-ascii";
  let meta = editdoc.getElementsByTagName("meta")[0];
  is(meta.getAttribute("http-equiv"), "Content-Type",
     "meta element should have http-equiv");
  is(meta.getAttribute("content"), "text/html;charset=us-ascii",
     "charset should be set as us-ascii");

  let dummyMeta = editdoc.createElement("meta");
  dummyMeta.setAttribute("name", "keywords");
  dummyMeta.setAttribute("content", "test");
  meta.parentNode.insertBefore(dummyMeta, meta);

  editor.documentCharacterSet = "utf-8";

  meta = editdoc.getElementsByTagName("meta")[0];
  isnot(meta.getAttribute("http-equiv"), "Content-Type",
     "first meta element shouldn't have http-equiv");

  meta = editdoc.getElementsByTagName("meta")[1];
  is(meta.getAttribute("http-equiv"), "Content-Type",
     "second meta element should have http-equiv");
  is(meta.getAttribute("content"), "text/html;charset=utf-8",
     "charset should be set as utf-8");

  SimpleTest.finish();
});
</script>
</pre>
</body>
</html>