test_bug772288.html 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <!DOCTYPE html>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=772288
  5. -->
  6. <head>
  7. <meta charset="utf-8">
  8. <title>Test for Bug 772288</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 onload="doTest()">
  13. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=772288">Mozilla Bug 772288</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. /** Test for Bug 772288 **/
  20. SimpleTest.waitForExplicitFinish();
  21. const Cu = SpecialPowers.Cu;
  22. function doTest() {
  23. msg = "Services should be imported on window";
  24. try {
  25. Cu.import("resource://gre/modules/Services.jsm", window);
  26. ok(Services, msg);
  27. } catch (ex) {
  28. ok(false, msg + " : " + ex);
  29. }
  30. msg = "Services should be imported on myObj";
  31. try {
  32. var myObj = {};
  33. Cu.import("resource://gre/modules/Services.jsm", myObj);
  34. ok(myObj.Services, msg);
  35. } catch (ex) {
  36. ok(false, msg + " : " + ex);
  37. }
  38. SimpleTest.finish();
  39. }
  40. </script>
  41. </pre>
  42. </body>
  43. </html>