test_bug713825.html 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=713825
  5. -->
  6. <head>
  7. <meta charset="utf-8">
  8. <title>Test for Bug 713825</title>
  9. <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  10. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  11. </head>
  12. <body>
  13. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=713825">Mozilla Bug 713825</a>
  14. <p id="display"></p>
  15. <div id="content" style="display: none">
  16. </div>
  17. <pre id="test">
  18. <script type="application/javascript">
  19. /**
  20. * Test for Bug 713825
  21. * test that nsIDocCharset still works backward compatibly
  22. */
  23. var Ci = SpecialPowers.Ci;
  24. var docShell = SpecialPowers.wrap(window).QueryInterface(Ci.nsIInterfaceRequestor).
  25. getInterface(Ci.nsIWebNavigation).
  26. QueryInterface(Ci.nsIDocShell);
  27. var charset1 = docShell.charset;
  28. var charset2 = docShell.QueryInterface(Ci.nsIDocCharset).charset;
  29. var charset3 = SpecialPowers.wrap(window).QueryInterface(Ci.nsIInterfaceRequestor).
  30. getInterface(Ci.nsIDocCharset).charset;
  31. /* if we get here without throwing and the three charsets are equal, all is OK */
  32. is(charset1, charset2, "QI'd nsIDocCharset.charset should equal nsIDocShell.charset");
  33. is(charset1, charset3, "getInterface'd nsIDocCharset.charset should equal nsIDocShell.charset");
  34. </script>
  35. </pre>
  36. </body>
  37. </html>