test_idle.html 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=815105
  5. -->
  6. <head>
  7. <meta charset="utf-8">
  8. <title>Test for Bug 815105 </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=815105">Mozilla Bug 815105 </a>
  14. <p id="display"></p>
  15. <div id="content" style="display: none"></div>
  16. <pre id="test">
  17. <script type="application/javascript;version=1.8" src="file_framework.js"></script>
  18. <script type="application/javascript;version=1.8">
  19. function verifier(success, failure) {
  20. try {
  21. var obs = {
  22. time: 1,
  23. onidle: function() {
  24. window.navigator.removeIdleObserver(obs);
  25. },
  26. }
  27. // addIdleObserver throws if prinicpal doesn't have the permission
  28. window.navigator.addIdleObserver(obs);
  29. success("idle");
  30. } catch (e) {
  31. failure("Got an exception " + e);
  32. }
  33. }
  34. var gData = [
  35. {
  36. perm: ["idle"],
  37. verifier: verifier.toSource(),
  38. }
  39. ]
  40. </script>
  41. </pre>
  42. </body>
  43. </html>